{str_cut($r[title], 36, '')} // 後面引號為去掉省略號
{date('Y-m-d H:i:s', $r[inputtime])} // 輸出:2011-05-06 11:22:33
{pc:get sql="SELECT * FROM v9_news WHERE id IN (SELECT id FROM v9_position_data WHERE posid in(27,28) and catid in(59,60,61)) order by listorder DESC" cache="3600" start="3" num="7" return="data"}
{loop $data $n $r}
·{str_cut($r[title],22,'')}
{/loop}
{/pc}
說明:文章範圍為欄目 59/60/61,推送至推薦位 27/28,從第 3 條開始取 7 篇。
{$catname} // 僅名稱
{$CATEGORYS[$r['catid']]['catname']} // 含連結
{$CATEGORY[$catid][parentid]} // 父欄目 ID
{$CATEGORYS[$CAT[parentid]][catname]} // 父欄目名稱
{pc:get sql="SELECT * FROM cq_member where mtype='企業'" cache="3600" dbsource="dedecmsdb" num="7" return="data"}
{loop $data $r}
{str_cut($r[uname],28,'')}
{/loop}
{/pc}
需在後台「資料源」添加 dedecmsdb 配置。
{pc:content action="category" catid="$catid" num="25" siteid="$siteid" order="listorder ASC"}
{loop $data $r}
{$r[catname]} |
{/loop}
{/pc}
{$CATEGORYS[22]['catname']} // 例:catid=22
{pc:content action="lists" catid="79" 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}
{pc:content action="lists" catid="66" order="listorder DESC" thumb="1" num="5"}
{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}
{pc:content action="position" posid="36" num="1" order="listorder DESC limit 1,1--"}
{pc:content action="position" posid="31" order="listorder DESC" limit='1,8--'}
{pc:content action="position" posid="27" order="listorder DESC" num="3" start="5"}
// 相當於 LIMIT 5,3
{pc:content action="lists" catid="$catid" num="10" order="id DESC" page="$page"}
{loop $data $r}
{$r[title]}
{php $keywords = explode(',', $r[keywords]);}
文章標簽:
{loop $keywords $keyword}
{$keyword}
{/loop}
{/loop}
{/pc}
注意:explode(',', ...) 依英文逗號分割。若關鍵字用空格分隔,改為 explode(' ', ...)。
{pc:content action="position" posid="8" order="listorder DESC" num="2"}
{loop $data $r}
{str_cut($r[title],26,'')}{if $n%2==1} |{/if}
{/loop}
{/pc}
{pc:content action="lists" catid="$catid" num="25" order="id DESC" page="$page" moreinfo="1"}
{loop $data $r}
[{$r['字段名']}] {$r[title]}
{/loop}
{/pc}
{php $arrchildid = $CATEGORYS[$CAT[parentid]][arrchildid]}
{pc:get sql="SELECT * FROM v9_news where catid in($arrchildid)" cache="3600" page="$page" num="12" return="data"}
修改 phpcms/modules/formguide/index.php 第 73 行:
// 原
showmessage(L('thanks'), APP_PATH);
// 改
showmessage(L('thanks'), HTTP_REFERER);
{pc:content action="lists" moreinfo=1 catid="2" order="id DESC" num="4"}
{loop $data $key $val}
- {$val['title']}
價格:{str_cut($v['自定義段'],100)}
{/loop}
{/pc}
推薦位調用同理,需在模型勾選「在推薦位標籤中調用」,且新增文章後需更新才生效。
修改 statics/js/ckeditor/plugins/image/dialogs/image.js:
// 找到
accessKey:'T','default':''
// 替換為
accessKey:'T','default':$('#title').val()
清除瀏覽器快取後生效。
修改 phpcms/modules/content/classes/content_output.class.php 約 100 行:
$rand_nums = rand(79, 186);
$views = $r['views'] + $rand_nums;
// 點擊一次增加 79~186 隨機數
phpcms/libs/classes/attachment.class.php 第 24 行 $this->upload_func = 'copy'; → 'move_uploaded_file'phpcms/modules/block/templates/search_content.tpl.php 第 13 行修正 form::select_category 參數支援內部/外部資料、分頁、自定義返回變量、跨資料庫調用。關鍵技巧:ORDER BY B.comments DESC LIMIT 3,7 可實現「跳過前 2 條評論最多的文章,取第 3-9 條」,解決縮略圖比例不佳問題。