Home > Backend Development > PHP Tutorial > How to make Empire CMS display headlines/top/recommendation tags_PHP tutorial

How to make Empire CMS display headlines/top/recommendation tags_PHP tutorial

WBOY
Release: 2016-07-13 10:33:16
Original
1570 people have browsed it

I am working on Empire CMS recently. If the article contains pictures, or the article is pinned, the corresponding logo needs to be displayed at the header of the list. Later, I implemented it with smart tags. I will record some here. I estimate there will be many. People will use it.

We output the information with the new icon (smart label format on the home page template) based on the release within 3 days:

[e:loop={栏目ID,显示条数,操作类型,只显示有标题图片}]
<?
$newimg=""; 
if(time()-$bqr[truetime]<=3*24*3600) 
{
$newimg="<img src='New图片地址'>";  
}
?>
<li>
<a href="<?=$bqsr[titleurl]?>" title="<?=$bqr[title]?>"  target="_blank"><?=esub($bqr[title],36)?></a><?=$newimg?>
</li>
[/e:loop] 
Copy after login

Note: The field value array variable is $bqr, and the corresponding field variable is $bqr[field name]. For example: the title field variable is $bqr[title].

First check "Use program code" on the list template, and we output the information with the new icon based on recommendations (the format on the list page template [list content template (list.var)]):

$newimg="; 
if($r[isgood]==1) 
{
$newimg='<img src='New图片地址'>';
}
$listtemp='<li><a href="[!--titleurl--]" title="[!--oldtitle--]">[!--title--]</a>'.$newimg.'</li>'; 
Copy after login

Note: The field value array variable is $r, and the corresponding field variable is $r[field name]. For example: the title field variable is $r[title]. Another variable defined is '.$newimg.'. Assign the final template content to the $listtemp variable.

More collection of conditions on home page templates:

if($bqr[isgood]==1)   //推荐  
if($r[firsttitle]==1)  //头条  
if($r[istop]==1)   //置顶  
if($bqr[isgood]==1&&$bqr[firsttitle]==1&&$bqr[istop]==1)  //置顶-头条-推荐 (组合使用)  
Copy after login

Finally, the actual code in use is given:

[e:loop={'selfinfo',20,0,0}]
<?
$newimg="";
$good="";
if(!empty($bqr[titlepic]))
{
	$newimg="<img src='http://www.bkjia.com/uploads/allimg/140411/22561T200-0.gif' />";
}
if($bqr[istop]==1)
{
	$good = "<img src='http://www.bkjia.com/uploads/allimg/140411/22561UD6-1.gif' />";
}
?> 
					<tr class="even">
						<td class="title">
							<h1><a href="<?=$bqsr[titleurl]?>" target="_blank"><?=sub($bqr[title],0,30,false)?></a>  <?=$newimg?>  <?=$good?></h1>
							<p class="intro">
								<?=sub($bqr[smalltext],0,80,false)?>[<a title="阅读全文" href="<?=$bqsr[titleurl]?>" target="_blank">详细内容</a>]
							</p>
						</td>
						<td><?=$bqr[myarea]?></td>
						<td><?=date('Y-m-d H:i:s', $bqr[newstime])?></td>
					</tr>
[/e:loop]
Copy after login

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/752509.htmlTechArticleI am working on Empire CMS recently. If the article contains pictures, or the article is pinned, it needs to be displayed at the header of the list. The corresponding logo was later implemented using smart tags. Here are some records, I guess...
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template