具体方法如下:
用个if判断语句,判断一个字段是否有东西,有责输出1,没有则输出2,
下面是的代码加载内容页模板中
{dede:field.字段名 runphp='yes'}
if(@me<>'')@me="如果audio字段里有东西就输出这个,支持html代码,并且可以在代码中使用@me来调用audio字段值,但是不要有双引号。";
else
@me="如果audio字段里没有东西就输出这个,也是支持html代码,并且也是可以在代码中使用@me来调用audio字段值,也是不要有双引号。";
{/dede:field.字段名}第二个展示方式和应用:
打开include/pub_dedetag.php
搜索
foreach($GLOBALS[$arr] as $k=>$v){更改成
$GLOBALS['autoindex']=0;
foreach($GLOBALS[$arr] as $k=>$v){
$GLOBALS['autoindex']++;搜索
$this->CTags[$i]->TagValue = $DedeMeValue; }
在后面加上
$str = $this->CTags[$i]->TagValue;
$str_count = $GLOBALS['autoindex'];
if( $this->CTags[$i]->GetAtt("iif")!="" ){
if(! eval("return {$this->CTags[$i]->GetAtt('iif')} ;" )){
if($this->CTags[$i]->GetAtt("elserun")) {
$this->CTags[$i]->TagValue=eval("return {$this->CTags[$i]->GetAtt('elserun')} ;" );
}else{
$this->CTags[$i]->TagValue='';
}
}
}完毕。
判断来源为空 {dede:fieldname=sourcerunphp=yes}if(@me==)@me=;else@me=来源:.@me;{/dede:field} 判断作者为空 {dede:fieldname=writerrunphp=y
代码如下: {ceip:channelartlisttype=son}liahref={ceip:fieldname=typeurl/}{ceip:fieldname=typename/}/a{ceip:php}$id=$refObj-Fields[id];$sql=(SELECT
判断是否有子栏目,有就输出 javascript:; ,没有子栏目就直接输出一级栏目的链接 {dede:fieldname=typeidrunphp=yes}global$dsq
首先打开include\archive.helper.php 查找: $tagss=explode(,,$tags); 改成: $tagss=explode(,$tags); 继续查找: $tags=explode(,,$tag); 改成