聯(lián)系官方銷售客服
1835022288
028-61286886
tag.html 模板頁,增加 分頁功能及其配套的偽靜態(tài)和路由適配。
問題:
{cache name=module-content return=c} {related module=$c.dirname tag=$tag.tags page=1 pagesize=10 urlrule=/index.php?s=tag&name=$get.name&page=[page]} <a href="{$t.url}">{$t.title}</a> {/related} {/cache} <!-- 下面是分頁標簽 --> <div class="pages"> {$pages} </div>
關鍵詞庫插件里,已經(jīng)配置了tag偽靜態(tài)URL。
tag/xxxx.html
訪問 tag/xxx.html 頁,會通過 上面的循環(huán)標簽輸出包含這個 {$get.name} 關鍵詞的所有數(shù)據(jù),
現(xiàn)在要實現(xiàn)分頁功能,按照223987.com的教程,已經(jīng)加了相關分頁參數(shù),
并且,動態(tài) 分頁模式下,分頁正常
/index.php?s=tag&name=hua&page=2
要實現(xiàn)的最終效果:
把 /index.php?s=tag&name=hua&page=2
這條動態(tài)分頁 URL ,重寫路由偽靜態(tài)實現(xiàn)
tag/xxxx/2.html
xxxx 是 關鍵詞轉拼音 也就是 {$get.name} 獲取到的關鍵詞
2.html 2是分頁頁碼
組合起來就是 tag/xxxx/2.html
目前,官網(wǎng)后臺現(xiàn)有的偽靜態(tài)功能,已經(jīng)可以訪問 /tag/hua.html
但是在 /tag/hua.html 頁,實現(xiàn)自定義URL偽靜態(tài)就不行了
比如 /tag/hua/2.html
2 分頁頁碼,
就不行了。所以要按照 我上面的需求改進。
試試下面規(guī)則 加到/config/rewrite.php 里面去
本身規(guī)則就是這樣寫的,光這樣弄不行。
回復@K大帥
我測試的也是識別不出來
好像和標簽有類關系 優(yōu)先識別子類的
需要在 config/custom.php 里 函數(shù)識別
回復@K大帥
那不知道了 得問下老大如何弄。。
第一步
"tag\/([a-z]+).html" => "index.php?s=tag&name=$1", //【tag】TagURL(tag/{tag}.html)
"tag\/([a-z]+)\/([0-9]+).html" => "index.php?s=tag&name=$1&page=$2",
第二部
{cache name=module-content return=c}
{related module=$c.dirname tag=$tag.tags page=1 pagesize=10 urlrule=tag/$get.name/[page].html}
<li class="text-truncate"><a href="{$t.url}">{$t.title} —— <span class="text-danger">{$t.zuozhe}</span>《{$t.shiming}》</a></li>
{/related}
{/cache}
搞定,快點給我錢
config/rewrite.php
<?ph $rule ="tag-".$get.name."-[page].html"; ?>
{related module=$c.dirname tag=$tag.tags page=1 pagesize=10 urlrule=$rule}
你這個循環(huán)體里面分頁啊,我覺得不現(xiàn)實,因為一個頁面只能有一個分頁標簽
兄弟啊,,tag.html 模板頁,本來就一個 {$pages} 分頁啊。。。
回復@易學習