PHPCMS 2008 Website Building Usage Code Collection

Source: Internet
Author: User
PHPCMS 2008 Website Construction Common Code collection
Fragments:
Article Summary: {str_cut ($r [Description],xx, ' ... ')}
Article URL: {$r [url]}
Article title: {$r [title]} {str_cut ($r [title],44, ')}
Article time: {date (' y-m-d ', $r [UpdateTime])}
Template path: {Skin_path}
Call Header page: {Template ' phpcms ', ' header '}
Business Link URL:/swt/go.php?from=xxx
Set Domain name:
Column name: {$catname}
Column + List Current location: {Catpos ($catid)}
Article page Current location: {catpos ($r [' catid '])}
Tag_ Label Content List
SELECT * from ' phpcms_content ' A, ' Phpcms_content_tag ' K where A.contentid=k.contentid and a.status=99 and k.tag= ' $tag ' ord ER by a.contentid desc
===============================================
category.html Common Tags:
==============================================
Call column URL: {$CATEGORY [$catid][url]} {$CATEGORY [112][url]}
Call Column name: {$CATEGORY [$catid][catname]} {$CATEGORY [112][catname]}
Call Hot articles (sort by monthly clicks):
{Get sql= "select A.* from ' phpcms_content ' A, ' Phpcms_content_count ' P WHERE a.contentid=p.contentid and a.status=99 ORDE R by P.hits_month DESC limit 2,5 "}


Call a news article 1 with a category ID of 36:
{Get Sql= "select * from ' phpcms_content ' where status=99 and catid=36 ORDER by updatetime DESC limit 0,1"}


Call a section under the general article 5, and pagination display:
{Get Sql= "select * from ' phpcms_content ' where status=99 and catid=80 ORDER by UpdateTime DESC" rows= "5" page= "$pages"}


Call thumbnail article 1:
{Get sql= "select Title,url,thumb,description from ' Phpcms_content ' where status=99 and thumb!= ' and catid=xxxx ORDER by u Pdatetime DESC limit 0,1 "} {$r [thumb]}
--------------------------------------------------
Index.html Common Tags:
----------------------------------------------------
Friendship Link:
{Get Sql= "select * from ' Phpcms_link ' where passed=1 order by Listorder"}
Link URL: {$r [url]}
Link name: {$r [name]}


Slide:
{Get sql= "select A.title,a.url,a.thumb from ' phpcms_content ' A, ' phpcms_content_position ' P WHERE a.contentid= P.contentid and p.posid=2 and a.status=99 and ' thumb '! = ' ORDER by A.contentid DESC}
linkarr[{$n}] = "{$r [url]}";
picarr[{$n}] = "{$r [thumb]}";




Website Hot Keywords:
{Get sql= "select Tag,hits from Phpcms_keyword order by Listorder desc,hits desc" rows= "10"}
{$r [tag]}
{$r [hits]}
{/get}


Get the sub-column under the parent column:


{Get Sql= "select * from ' phpcms_category ' where parentid = $catid order by Listorder"}

{Get Sql= "select * from ' phpcms_content ' where status=99 and catid = $r [catid] ORDER by updatetime DESC" rows= "4" return= " Ar "}
Column link URL {$ar [url]}
Column name {$ar [catname]}
{/get}
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
list.html Common Tags:
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
The current column of article 10 per page pagination code
{Get Sql= "select * from ' phpcms_content ' where catid = $catid and status=99 order by updatetime Desc" rows= "" page= "$pag Es "}


Paging: {$pages}


Recommended reading; Home Page posid=1 home page Spotlight posid=2 Home headlines posid=3 list recommended posid=4 content page recommended posid=5


{Get sql= "select A.* from ' phpcms_content ' A, ' phpcms_content_position ' P WHERE a.contentid=p.contentid and P.posid=1 and A.status=99 and a.catid=39 ORDER by updatetime Desc "rows=" 1 "}
{/get}




4, the custom return variable, example (call column ID 1 through the audit of 10 information, the title length of not more than 25 Chinese characters, display the update date, the return variable is $v):


{Get Sql= "select * from Phpcms_content where catid=1 and status=99 order by updatetime Desc" rows= "ten" return= "V"} title: {str_ Cut ($v [title], url:{} $v [URL]} Update Date: {date (' y-m-d ', $v [UpdateTime])} {/get}


5, call other databases under the same account, example (call the database for BBS, category ID 1 of the 10 latest theme, the theme length of not more than 25 kanji, display the update date): {Get Dbname= "BBS" sql= "SELECT * from Cdb_threads where fid=1 ORDER BY dateline Desc "rows=" 10 "} topic: {Str_cut ($r [subject],)} url:http://bbs.phpcms.cn/viewthread.php? tid={$r [tid]} Update Date: {date (' y-m-d ', $r [Dateline])} {/get}


6, call external data, example (call data source for BBS, category ID 1 of the 10 latest theme, the theme length of not more than 25 kanji, display update date): {Get dbsource= "BBS" sql= "select * from Cdb_threads where Fid=1 ORDER BY dateline Desc "rows=" 10 "} topic: {Str_cut ($r [subject],)} url:http://bbs.phpcms.cn/viewthread.php?tid={$r [Tid]} Update Date: {date (' y-m-d ', $r [Dateline])} {/get}


7. Call Ecshop data, example (call data source Ecshop, call the latest 5 products in the product library): {Get dbsource= "ecshop" sql= "select ' goods_id ', ' goods_name ', ' Goods_ Thumb ' from ' ecs_goods ' ORDER by ' goods_id ' DESC "rows=" 5 "} product id:{$r [goods_id]} name: {$r [goods_name]} product Picture: {$r [goods_thumb ]} {/get}


To obtain the current large column under the various small columns of the article;

{Get Sql= "select * from ' phpcms_content ' where status=99 and CatID in ($arrchildid 1) ORDER by inputtime ASC" rows= "1"}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
show.html page Label:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Article title: {if $titleintact} {$titleintact}{else}{$title}{/if}
Article source: {$copyfrom}
Article author: {$author}
Update Time: {date (' y-m-d ', $r [UpdateTime])}
Article content: {$content}
Previous article:
{Get Sql= "select * from ' phpcms_content ' WHERE ' ContentID ' < ' $contentid ' and status = The ORDER by inputtime DESC" rows = "1"}
{$r [title]}


Next article:
{Get Sql= "select * from ' phpcms_content ' WHERE ' ContentID ' > ' $contentid ' and status = The ORDER by inputtime DESC" rows = "1"}
{$r [title]}
Related articles:
{Get Sql= "select * from ' phpcms_content ' where status=99 and catid= $catid ORDER by updatetime DESC limit 0,10"}
This article tags/keywords:
{Get sql= "select P.tag from ' phpcms_content ' A, ' Phpcms_content_tag ' P WHERE A.contentid=p.contentid and a.status=99 order by updatetime Desc "rows=" 1 "}

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.