100字范文,内容丰富有趣,生活中的好帮手!
100字范文 > 织梦DedeCMS模板在runphp=yes的标签中调用其他field值的方法

织梦DedeCMS模板在runphp=yes的标签中调用其他field值的方法

时间:2021-12-31 17:48:19

相关推荐

织梦DedeCMS模板在runphp=yes的标签中调用其他field值的方法

DedeCms Runphp 标签中调用其他变量的方法

都知道,在DedeCMS中是可以使用PHP的,常见的方法就是if else了,例如模板制作中,需要对来源和作者进行判断,如果为空,则提示:暂无或不详,样例:

1

{dede:field name=sourcerunphp=yes}

2

if(@me =="") @me ="";else@me ="来源:".@me;

3

{/dede:field}

但是如果想在上边的代码中调用其他变量,怎么调用呢?小编就遇到这个问题,在织梦官方论坛查找了一下,现在将方法公布如下,将变量写为通用:array,代码如下:

1

{dede:field name=arrayrunphp=yes}

2

3

if(@me[source] =="") @me ="@me[其它变量]";else@me ="来源:".@me[source];

4

5

{/dede:field}

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。