Many webmasters who use Imperial CMS to build their websites will encounter situations where the title is too long, resulting in confusing page layout. At this time, it is often necessary to intercept the title and add an ellipsis to solve it. In this regard, the Empire CMS universal tag title will automatically add ellipses after intercepting it. If the word count is not reached, ellipses will not be added. You can use the following method to solve the problem:
1. Open e/class/connect.php
Query the ReplaceListVars function and find the
code at approximately line 2224:
if(!empty($subtitle))//截取字符
Add the code below:
The code is as follows:
if ($r[title] != $r[oldtitle])
{
$value=sub($value,0,$subtitle,false,'...');
}
The modified code is as follows:
The code is as follows:
if(!empty($subtitle))//Intercept characters
{
if($r[title] != $r[oldtitle])
{
$value=sub($value,0,$subtitle,false,'...');
}
}
2. Open e/class/t_functions.php
Find approximately at line 637:
The code is as follows:
$r[oldtitle]=$r[title];
Approximately at line 638, that is, add below $r[oldtitle]=$r[title];
The code is as follows:
$r[title]=sub ($r[title],0,$strlen,false);
The modified code is as follows:
The code is as follows:
while($r=$empire- >fetch($sql))
{
$r[oldtitle]=$r[title];
//Modify
$r[title]=sub($r[title], 0,$strlen,false);
The above is the detailed content of Imperial cms universal tag realizes the method of automatically adding ellipses after title interception. For more information, please follow other related articles on the PHP Chinese website!