dedecms文章添加字段填栏目id,内容页调用字段里的栏目文章

在织梦模型里增加个字段,然后在添加文章的时候,在字段里填了栏目id进去

在织梦网站前台的内容页,调用这个字段栏目的多个文章出来

{dede:field.field1 runphp=yes}
global $dsql;
$sql = "select arc.*,tp.typedir,tp.typename,tp.corank,tp.isdefault,
tp.defaultname,tp.namerule,tp.moresite,tp.siteurl,tp.sitepath
from `58pic_archives` arc left join `58pic_arctype` tp on arc.typeid=tp.id where tp.id in (@me) LIMIT 10";
$dsql->SetQuery($sql);
$dsql->Execute('t');
$result = '';
while($row = $dsql->GetArray('t'))
{
    $arcurl=GetOneArchive($row['id']);
    $pubdate = MyDate('Y-m-d H:i:s',$row['pubdate']);
    $result .= "<li><span>{$pubdate}</span><a href=\\"{$arcurl['arcurl']}\\">{$row['title']}</a></li>";
}
@me = $result;
{/dede:field.field1}

field1为字段名称

声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。

给TA打赏
共{{data.count}}人
人已打赏
个人中心
购物车
优惠劵
今日签到
有新私信 私信列表
搜索