PHPCMS代碼生成器是一款由個人制作的專門用于PHPCMS編程的輔助軟件,通過PHPCMS代碼生成器,用戶能夠快速的生成PHPCMS代碼只需要復(fù)制到編程工具中即可快速實(shí)現(xiàn)功能,有了PHPCMS代碼生成器能夠減少工程師大量的編程時(shí)間,同時(shí)也能讓一些沒有編程經(jīng)驗(yàn)的用戶快速掌握PHPCMS進(jìn)行編程。
軟件特色:
1、支持全局調(diào)用:網(wǎng)站名稱、關(guān)鍵字、資源路徑等十多項(xiàng);
2、支持首頁調(diào)用:設(shè)為首頁、導(dǎo)航代碼、焦點(diǎn)圖等十多項(xiàng);
3、支持列表標(biāo)簽、功能表情、文章標(biāo)簽:文章模型、下載模型等生成;
4、支持采集參數(shù)、參數(shù)列表等。
使用方法:
下載打開軟件,選擇要添加的標(biāo)簽,軟件就會自動生成代碼,用戶只需要優(yōu)化代碼中的一段即可。
注意事項(xiàng):
1.調(diào)用系統(tǒng)內(nèi)單條數(shù)據(jù),示例(調(diào)用ID為1的信息,標(biāo)題長度不超過25個漢字,顯示更新日期):
{get sql="select * from phpcms_content where contentid=1" /}
標(biāo)題:{str_cut($r[title], 50)} URL:{$r[url]} 更新日期:{date('Y-m-d', $r[updatetime])}
{/get}
2.調(diào)用系統(tǒng)內(nèi)多條數(shù)據(jù),示例(調(diào)用欄目ID為1通過審核的10條信息,標(biāo)題長度不超過25個漢字,顯示更新日期):
{get sql="select * from phpcms_content where catid=1 and status=99 order by updatetime desc" rows="10"}
標(biāo)題:{str_cut($r[title], 50)} URL:{$r[url]} 更新日期:{date('Y-m-d', $r[updatetime])}
{/get}
3.帶分頁,示例(調(diào)用欄目ID為1通過審核的10條信息,標(biāo)題長度不超過25個漢字,顯示更新日期,帶分頁):
{get sql="select * from phpcms_content where catid=1 and status=99 order by updatetime desc" rows="10" page="$page"}
標(biāo)題:{str_cut($r[title], 50)} URL:{$r[url]} 更新日期:{date('Y-m-d', $r[updatetime])}
{/get}
分頁:{$pages}
4.自定義返回變量,示例(調(diào)用欄目ID為1通過審核的10條信息,標(biāo)題長度不超過25個漢字,顯示更新日期,返回變量為 $v):
{get sql="select * from phpcms_content where catid=1 and status=99 order by updatetime desc" rows="10" return="v"}
標(biāo)題:{str_cut($v[title], 50)} URL:{$v[url]} 更新日期:{date('Y-m-d', $v[updatetime])}
{/get}
5.調(diào)用同一帳號下的其他數(shù)據(jù)庫,示例(調(diào)用數(shù)據(jù)庫為bbs,分類ID為1的10個最新主題,主題長度不超過25個漢字,顯示更新日期):
{get dbname="bbs" sql="select * from cdb_threads where fid=1 order by dateline desc" rows="10"}
主題:{str_cut($r[subject], 50)} URL:http://bbs.phpcms.cn/viewthread.php?tid={$r[tid]} 更新日期:{date('Y-m-d', $r[dateline])}
{/get}
6.調(diào)用外部數(shù)據(jù),示例(調(diào)用數(shù)據(jù)源為bbs(discuz),分類ID為1的10個最新主題,主題長度不超過25個漢字,顯示更新日期):
{get dbsource="bbs" sql="select * from cdb_threads where fid=1 order by dateline desc" rows="10"}
主題:{str_cut($r[subject], 50)} URL:http://bbs.phpcms.cn/viewthread.php?tid={$r[tid]} 更新日期:{date('Y-m-d', $r[dateline])}
{/get}
7.取出第2條到第10條記錄,按評論多少排序,比如有些布局第一條使用縮略圖,或者第一條是頭條,其他是文章列表會用到:
{get sql="select A.contentid,A.catid,A.title,A.thumb,A.description,A.url,A.status,A.updatetime,B.contentid,B.hits,B.comments from `phpcms_content` as A INNER JOIN `phpcms_content_count` as B ON A.contentid=B.contentid and A.status=99 and LENGTH(A.thumb)>0 order by B.comments desc LIMIT 2,7"}-->
{$r[comments]}人參與評論</span>·<a href="{$r[url]}" title="{$r[title]}">{str_cut($r[title], 28)}</a>
{/get}
關(guān)鍵點(diǎn)就在 order by B.comments desc LIMIT 3,7 (表示從第3條記錄開始,向下讀取7條數(shù)據(jù))