Phpcms Common Code (i)
1. Remove the ellipsis that appears after the title limit
{Str_cut ($r [title],36, ')}
2. Format Time 2011-05-06 11:22:33
{Date (' y-m-d h:i:s ', $r [Inputtime])}
3. Format time May 06, 2011
{Date (' Y year m D Day ', $r [Inputtime])}
4. Display column name (only name, without link)
{$catname}
5. Display the column name and link (can click)
{$CATEGORYS [$r [' catid ']][' catname '}
6. External data source invocation
{pc:get sql= "select * from Pre_forum_thread" cache= "3600" dbsource= "Discuz" return= "Data" num= "10"}
7. Call the Sub-column (in the column homepage template needs to use)
{pc:content action= "category" Catid= "$catid" num= "siteid=" $siteid "order=" Listorder ASC "} {Loop $data $r}
{$r [catname]} | {/loop} {/PC}
8. Display the column name of the specified ID (example here catid=22)
{$CATEGORYS [22][' CatName ']}
9. Show the article category before the article
{pc:content action= "lists" catid= "" order= "Listorder DESC" num= "14"}
{Loop $data $n $r}
{if $TYPE [$r [Typeid]][name]} [{$TYPE [$r [Typeid]][name]}] {/if} {Str_cut ($r [title],33, ')}
{/loop} {/PC}
10. Specify the variable loop growth (slides are often used)
{pc:content action= "lists" catid= "5" order= "Listorder DESC" thumb= "1" num=
{php $num = 0}
{Loop $data $r}
linkarr[{$num}] = "{$r [url]}";
picarr[{$num}] = "{$r [thumb]}";
textarr[{$num}] = "{str_cut ($r [title],36, ')}";
{PHP $num + +}
{/loop}
{/PC}
11. Article calls using limit
{pc:content action= "position" posid= "$" num= "1" order= "Listorder DESC limit 1,1--"}
Everything else is used as before.
{pc:content action= "position" posid= "order=" Listorder DESC "limit= ' 1,8--'}
{Loop $data $r}
{Str_cut ($r [title],36, ')}
{/loop}
{/PC}
12.phpCMS Link Query
{pc:get sql= "select * from V9_news a joins V9_news_data B on A.id=b.id where catid=27" cache= "3600" page= "$page" return= "da Ta "}
{Loop $data $key $val}
- {$val [title]}
{/loop}
{if $pages} {$pages} {/if}
{/PC}
{$val [content]}
13.phpCMS previous post, next article
Previous article: {$previous _page[title]}
Next article: {$next _page[title]}
Note: There can be no target= "_blank" error in a tag.