好得很程序员自学网

<tfoot draggable='sEl'></tfoot>

dedecms中runphp=yes标签调用方法 - DeDecms

dedecms中runphp=yes标签调用方法

在dedecms中如果有一些模板标签实现不了我逻辑我们可以直接在页面调用php标签了,我们只要在模板中使用runphp=yes然后就可以进入常用的php写法了,具体看一些例子.

runphp='yes'在循环中的应用,代码如下:

{dede:arclist  row = 14   titlelen = 32   noflag = 'h' }       < li > < a   href = "[field:arcurl/]" > [field:title/] </ a >    [field:id  runphp = 'yes' ]   if(@ me ==5){    @ me = '选中' ;   }else{    @ me = '没选中' ;   }   [/field:id] 

那么我们再来一些更高级的runphp=yes标签中调用其他field值,例子,代码如下:

{dede:php}$GLOBALS['xxoo']=$refObj- > Fields['fieldname']{/dede:php}   {dede:field.xxxx  runphp = "yes" }@ me = "test" .@me."-test".$GLOBALS['xxoo'];{/dede:field.xxxx} 

即,先开一个PHP的标签,把想赋的值替换给global变量,然后在另外的运行中将field值赋值给他,如果是内容页使用以下代码:

{dede:field.id runphp= 'yes' }  global   $cfg_cmspath ;  $tags  = GetTags(@me);  $revalue  =  '' ;  $tags  =  explode ( ',' ,  $tags );  foreach ( $tags   as   $key  =>  $value ){               if ( $value ){                   $revalue  .=  '<a href="' . $cfg_cmspath . '/tags.php?/' . $value . '/">' . $value . '</a>, ' ;   //phpfensi.com      }    }  @me =  $revalue ;  {/dede:field.id}

查看更多关于dedecms中runphp=yes标签调用方法 - DeDecms的详细内容...

  阅读:67次