根据itemid调用改信息的content

分类栏目:destoon实战

107

在自定义函数中\api\extend.func.php中加入以下代码

注释如下

//根据文章id获取分表内容 //第一个参数$moduleid 如果是在非当前模块使用需要写死,如在站点首页: {getContentbyId(21,$t[itemid])} //如果是当前模块,可以直接用$moduleid,如在资讯页面: {getContentbyId($moduleid,$t[itemid])} //如果不分表的话可以多传一个0,{getContentbyId($moduleid,$t[itemid],0)}, //当前模块还可以直接{getContentbyId($moduleid,$t[itemid],$MOD['split'])}, //不传第三个参数默认为分表模式(dt后台模块设置里可以开启,可以起到优化的作用)

//调取当前id对应的内容 function getContentbyId($moduleid,$itemid,$split=1){ global $db; $content_table = content_table($moduleid, $itemid,$split); $t = $db->get_one("select content from {$content_table} where itemid=$itemid"); return $t['content']; }