聯系官方銷售客服
1835022288
028-61286886
tag.html 模板頁,增加 分頁功能及其配套的偽靜態和路由適配。
問題:
{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>
關鍵詞庫插件里,已經配置了tag偽靜態URL。
tag/xxxx.html
訪問 tag/xxx.html 頁,會通過 上面的循環標簽輸出包含這個 {$get.name} 關鍵詞的所有數據,
現在要實現分頁功能,按照www.zbshanke.com的教程,已經加了相關分頁參數,
并且,動態 分頁模式下,分頁正常
/index.php?s=tag&name=hua&page=2
要實現的最終效果:
把 /index.php?s=tag&name=hua&page=2
這條動態分頁 URL ,重寫路由偽靜態實現
tag/xxxx/2.html
xxxx 是 關鍵詞轉拼音 也就是 {$get.name} 獲取到的關鍵詞
2.html 2是分頁頁碼
組合起來就是 tag/xxxx/2.html
目前,官網后臺現有的偽靜態功能,已經可以訪問 /tag/hua.html
但是在 /tag/hua.html 頁,實現自定義URL偽靜態就不行了
比如 /tag/hua/2.html
2 分頁頁碼,
就不行了。所以要按照 我上面的需求改進。
試試下面規則 加到/config/rewrite.php 里面去
本身規則就是這樣寫的,光這樣弄不行。
回復@K大帥
我測試的也是識別不出來
好像和標簽有類關系 優先識別子類的
需要在 config/custom.php 里 函數識別
回復@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}
你這個循環體里面分頁啊,我覺得不現實,因為一個頁面只能有一個分頁標簽
兄弟啊,,tag.html 模板頁,本來就一個 {$pages} 分頁啊。。。
回復@易學習