phpcms 開發的一些總結
阿新 • • 發佈:2018-12-24
1 在模板中擷取內容的長度進行顯示
{str_cut(strip_tags($r[content]),300)}
2 在詳情頁(show.html)顯示 標題 、內容 、 時間、 上一條 、 下一條 、 返回列表
{$title} {$content} {$inputtime}
<div class="xgwz">
<a href="{$previous_page[url]}" class="xg"><strong>上一條:</strong>{$previous_page[title]}</a>
<a href="{$next_page[url]}" class="xg"><strong>下一條:</strong>{$next_page[title]}</a>
<a href="{$CATEGORYS[$catid][url]}" class="more">返回列表<img src="{IMG_PATH}/new/more3.png" width="16" height="16" /></a>
</div>
3 列表頁 迴圈顯示 並分頁
<div class="listnr">
<ul>
{pc:content action="lists" catid="$catid" num="10" order="id DESC" page="$page"}
{loop $data $v}
<li><a href="{$v[url]}" title="{$v[title]}" >{$v[title]}</a><span>{date('Y-m-d',$v[updatetime])}</span></li>
{/loop}
{/pc}
</ul>
<div class="page" >
{$pages}
</div>
</div>
4 在列表頁迴圈顯示 並且檢視每一條的詳情頁
加個屬性 moreinfo="1"
5 在迴圈過程中 獲取第一個元素 做單獨處理
{pc:content action="position" posid="2" catid="10" order="listorder DESC" num="5"}
{php $arr=array_values($data)}
{loop $arr $k $r}
{if $k==0}
<a href="#"><img src="{$r['thumb']}" width="222" height="146" /></a>
<div class="fuhua_ppt1">
<p class="fuhua_ppt1_p"><a href="{$r[url]}" title="{$r['title']}" >{$r[title]}</a>{date('Y-m-d', $r['inputtime'])}</p>
<p class="fuhua_ppt1_p1">{$r['description']}</p>
<a href="{$r[url]}" class="more"><img src="{IMG_PATH}/new/more.png" /></a>
</div>
{/if}
{/loop}
{/pc}
6 更改網站域名
除了在後臺的站點管理和基本配置的更改 ,系統檔案\caches\configs\system.php 的app_path 動態域名配置也要更改,更新快取後如果跳轉還是原來的域名 , 可以把sql檔案匯出來 ,進行一次新的域名替換