zoukankan      html  css  js  c++  java
  • phpcms的关键词tag重写为拼音格式

    修改拼音支持

    打开 phpcmsmodulescontent ag.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']); 

    修改为

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

    URL重写规则,例子:d/xdsdfs/1 d/{$r[pinyin]}/{$page}

    rewrite ^/d/([a-z-A-Z-0-9]+) /index.php?m=content&c=tag&a=lists&tag=$1&page=$2 last; 
    
    rewrite ^/d/([a-z-A-Z-0-9]+)/([0-9]+) /index.php?m=content&c=tag&a=lists&tag=$1&page=$2 last;

    文章列表页调用关键字,或者首页调用关键字,如index或者list

    {php $keywords = explode(',',$r[keywords]);}
    {loop $keywords $keyword}{pc:get sql="SELECT * FROM where keyword = '$keyword' " return="datatag"}{loop $datatag $r}<a target="_blank" href="//www.wendaba.com/tiku/{$r[pinyin]}" title="{$keyword}">{$keyword}</a>{/loop}
    {/pc}
    {/loop}

    打开phpcms emplatesdefaultcontentshow.html 模板文件

    将
    {loop $keywords $keyword}
    <a href="{APP_PATH}index.php?m=content&c=tag&a=lists&tag={urlencode($keyword)}" class="blue">{$keyword}</a>
    {/loop}
    修改为
    {loop $keywords $keyword}
    {pc:get sql="SELECT * FROM v9_keyword where keyword = '$' " return="dattag"}{loop $datatag $r}<a href="https//www.wentiyi.com/" class="blue">{$r[keyword]}</a>
    {/loop}{/pc}
    {/loop}
  • 相关阅读:
    MySQL优化
    数据库之事务
    浮动与定位的区别
    CSS-画三角
    CSS(中)篇
    CSS(前)篇
    html篇
    定位真机运行能用但是打包成apk就不能用的解决方法
    定位与权限
    activity与fragment之间的传递数据
  • 原文地址:https://www.cnblogs.com/jackMRchen/p/14290497.html
Copyright © 2011-2022 走看看