Empire CMS content list templates [- empirenews.listtemp--!] Smart Tags rewritten as [e: loop = {}]

Description of Requirement:

  1. The list of units under the topic list, or automatically based on the thematic page title page keyword to match the display;

  2. The first match exactly behind eleven fuzzy matching, the total number of 12;

Text template, introducing part:

[!--empirenews.listtemp--]<!--list.var2-->[!--empirenews.listtemp--]

    <ul class="clearfix mainCont">

    [!--empirenews.listtemp--]<!--list.var2-->[!--empirenews.listtemp--]

    </ul>

 This section is currently pushing to get a list of parameters, so getting to automatic, using Smart Tags;

step:

  1. Delete [-! Empirenews.listtemp -] <-! List.var2 -> [-! Empirenews.listtemp--] referenced module,

  2. list.var module, $ listtemp quotation mark to wrap part of html copy the contents of the template module deletes the original introduction of location;

  3. Add Smart Tags [e: loop = {}] html partially encased added,

  4. Find the corresponding data table (where I need to find is to download the table that [! Db.pre!] Ecms_download),

  5. Locate the current data table (enewszt) thematic template top topic of the query variable $ zr

 

  6.将要查询表中的标题(title)或关键词(keyboard)匹配当前页面的页面关键词(ztpagekey,前面加上查询变量$zr,使用%包裹,表示模糊查询),限制为11(因为第一条要精确匹配);

    <ul class="clearfix mainCont">

[e:loop={"select * from [!db.pre!]ecms_download where title like '%$zr[ztpagekey]%' or keyboard like '%$zr[ztpagekey]%' limit 11",0,24,0}]
<li><p>< a href="<?=$bqr[titleurl]?>" class="img" preview="'.<?=$bqr[titlepic]?>.'"><img src="'.<?=$bqr[titlepic]?>.'"></ a><i>< a href="<?=$bqr[titleurl]?>"><strong><?=$bqr[title]?></strong></ a><span class="xj lstar<?=$bqr[star]?>">等级:</span><span class="bb"><?=$bqr[softsq]?></span><span class="time"><?=$bqr[newstime]?></span><span class="size"><?=$bqr[filesize]?></span><span class="lan"><?=$bqr[language]?></span></i><s><a rel="nofollow" href="<?=$bqr[titleurl]?>" target="_blank">下载</ a></s><em><font>内容导读:</font><strong><?=$bqr[smalltext]?></strong></em><span class="platform"><font></font></span> </p></li>
[/e:loop]

    </ul>

  7.再复制该[e:loop={}]语句,置于第六条[e:loop={}]语句之上,进行精确查询;

    <ul class="clearfix mainCont">

[e:loop={"select * from [!db.pre!]ecms_download where  title regexp '(^|,)$title($|,)'",0,24,0}]
<li><p>< a href="<?=$bqr[titleurl]?>" class="img" preview="'.<?=$bqr[titlepic]?>.'"><img src="'.<?=$bqr[titlepic]?>.'"></ a><i>< a href="<?=$bqr[titleurl]?>"><strong><?=$bqr[title]?></strong></ a><span class="xj lstar<?=$bqr[star]?>">等级:</span><span class="bb"><?=$bqr[softsq]?></span><span class="time"><?=$bqr[newstime]?></span><span class="size"><?=$bqr[filesize]?></span><span class="lan"><?=$bqr[language]?></span></i><s><a rel="nofollow" href="<?=$bqr[titleurl]?>" target="_blank">下载</ a></s><em><font>内容导读:</font><strong><?=$bqr[smalltext]?></strong></em><span class="platform"><font></font></span> </p></li>
[/e:loop]


[e:loop={"select * from [!db.pre!]ecms_download where  title like '%$zr[ztpagekey]%' or keyboard like '%$zr[ztpagekey]%' limit 11",0,24,0}]
<li><p>< a href="<?=$bqr[titleurl]?>" class="img" preview="'.<?=$bqr[titlepic]?>.'"><img src="'.<?=$bqr[titlepic]?>.'"></ a><i>< a href="<?=$bqr[titleurl]?>"><strong><?=$bqr[title]?></strong></ a><span class="xj lstar<?=$bqr[star]?>">等级:</span><span class="bb"><?=$bqr[softsq]?></span><span class="time"><?=$bqr[newstime]?></span><span class="size"><?=$bqr[filesize]?></span><span class="lan"><?=$bqr[language]?></span></i><s><a rel="nofollow" href="<?=$bqr[titleurl]?>" target="_blank">下载</ a></s><em><font>内容导读:</font><strong><?=$bqr[smalltext]?></strong></em><span class="platform"><font></font></span> </p></li>
[/e:loop]

    </ul>

 

 注意:

精确查找SQL使用——where title regexp '(^|,)匹配参数($|,)'

模糊查找SQL使用——title like '%匹配参数%'

参考文章:

https://blog.csdn.net/abc2575/article/details/82659721

Guess you like

Origin www.cnblogs.com/chig/p/11988271.html