卓越飞翔博客卓越飞翔博客

卓越飞翔 - 您值得收藏的技术分享站
技术文章64334本站已运行4115

phpcms二次开发用拼音作为tags列表页路径的方法

PHPCMS V9中TAGS列表页中文的路径到底利不利于优化,众说纷纭,到底用拼音还是中文呢?今天先把方法互动给大家,期望对需要的朋友存有协助,本文只是将路径中的中文修正为拼音,未涉及伪静态问题,你可以在修改为拼音后参照CMS集中营下面这篇文章去设置伪静态。
下面开始传授phpcms v9中tags列表页URL用拼音作为路径的方法
打开 phpcmsmodulescontenttag.php文件
找出

$r = $this->keyword_db->get_one(array('keyword'=>$tag, 'siteid'=>$this->siteid), 'id');

修改为

$r = $this->keyword_db->get_one(array('pinyin'=>$tag, 'siteid'=>$this->siteid), 'id,pinyin,keyword');

找出

$tagid = intval($r['id']);

在此代码下边添加

$tagzw = $r['keyword'];

打开phpcmstemplatesdefaultcontentshow.html 模板文件

{loop $keywords $keyword}{$keyword}     {/loop}

修正为

{loop $keywords $keyword}
{pc:get sql="SELECT * FROM v9_keyword where keyword = '$keyword' " return="datatag"}{loop $datatag $r}
{$r[keyword]}
{/loop}{/pc}
{/loop}

打开phpcmstemplatesdefaultcontenttag_list.html 模板文件
原来{$tag}表明的是中文,现在显示的就是拼音,如果存有需要显示中文将{$tag}替代为{$tagzw}即可
打开phpcmstemplatesdefaultcontenttag.html 模板文件

{loop $infos $info}
{$info['keyword']}({$info['videonum']})
{/loop}

修改为

{pc:get sql="SELECT * FROM v9_keyword ORDER BY `videonum` DESC" return="datatag" num="30"}
{loop $datatag $r}{$r[keyword]} {/loop}
{/pc}
卓越飞翔博客
上一篇: DedeCMS登录卡死解决方法
下一篇: PHPCMS二次开发修改搜索结果排序方法
留言与评论(共有 0 条评论)
   
验证码:
隐藏边栏