用以下代码实现:
{dede:field.typeid runphp='yes'} $ID = @me; $sql = "SELECT * FROM `dede_arctype` WHERE id=$ID"; $query = mysql_query($sql); $row=mysql_fetch_array($query); $arcpic = "$row[arcpic]"; $typename = "$row[typename]"; if($arcpic == null) @me = '<div><h1>'.$typename.'</h1></div>'; else @me = '<img src="'.$arcpic.'" width="100%" border="0" />'; {/dede:field.typeid}