织梦文章添加字段填栏目id,内容页嵌套调用字段里的栏目文章

在模型里增加个字段,然后在添加文章的时候,在字段里填了栏目id进去
在前台的内容页,这个字段栏目的多个文章调用方法

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
{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 `dede_archives` arc left join `dede_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 .= <<< TPL
<ul class="a1">
<li><span>{$pubdate}</span><a href="{$arcurl['arcurl']}">{$row['title']}</a></li>
</ul>
TPL;
}
@me = $result;
{/dede:field.field1}

field1 为字段名称 

 

首页 > 织梦dedecms教程