织梦在channel标签的currentstyle中使用全局变量

织梦教程 强烈建议 2024-02-06 14:10 106 0

  织梦dedecms在channel标签的currentstyle中使用全局变量。

  在 include/taglib/channel.lib.php line 140

  $linkOkstr=str_replace("~typename~",$row['typename'],$linkOkstr);

  后面补上一句

  $linkOkstr=preg_replace_callback('/\~global\.(\w+)?\~/i', function($matches)

  { return $GLOBALS[$matches[1]]; }, $linkOkstr);

  即可如下使用:

  {dede:channel type='top' row='10' currentstyle="

  •   ~typename~

  • "}

      

  •   [field:typename/]

  •   {/dede:channel}



    时间:(2024-02-06 14:10:51)
    本站资源均来自互联网或会员发布,如果不小心侵犯了您的权益请与我们联系。我们将立即删除!谢谢!