筆者今日在DEDECMS論壇看到有朋友咨詢關(guān)于《DEDECMS有短標(biāo)題則顯示短標(biāo)題,沒有則顯示文章標(biāo)題》的實(shí)現(xiàn)方法,其實(shí)這個(gè)并不難實(shí)現(xiàn),靈活的DEDECMS是可以做到的,例如DEDE早期版本中的“有來源顯示來源,無來源不顯示”、“有作者顯示作者,無作者不顯示”。
方法一:
{dede:field name='array' runphp='yes'} if (@me['shorttitle']=='') @me=@me['title'];else @me=@me['shorttitle'];{/dede:field}
這個(gè)可以使用,但是這個(gè)不能在 {dede:arclist} 標(biāo)簽中套用。
方法二:
[field:array runphp='yes'] if (@me['shorttitle']=='') @me=@me['title'];else @me=@me['shorttitle'];[/field:array]
這個(gè)方法可以在{dede:arclist}標(biāo)簽中套用。