织梦DEDECMS文章正文调用代码为{dede:field.body/},这样图片和文章都调用出来了。能不能分开调用呢?当然可以啦!调用 代码如下
内容文字
<div>
{dede:field.body runphp=yes}
$string = @me;
$result = preg_replace("/<\s{0,}img[^>]+>/i",'',$string);
@me = $result;
{/dede:field.body}
</div>内容图片
<div>
{dede:field.body runphp=yes}
$string = @me;
preg_match_all("/<img([^>]*)\s*src=('|\")([^'\"]+)('|\")/",$string,$matches);
$imgsrc_arr = array_unique($matches[3]);
foreach($imgsrc_arr as $imgsrc)
{
$result .= "<li><img class=\"img\" src=\"$imgsrc\"></li>\n";
}
@me = $result;
{/dede:field.body}
</div>
织梦二次开发QQ群
本站客服QQ号:862782808(点击左边QQ号交流),群号(383578617)
如果您有任何织梦问题,请把问题发到群里,阁主将为您写解决教程!
转载请注明: 织梦模板 » 织梦DEDECMS文章内容body图文分离调用代码
















![织梦列表页多种属性排序[ajax]-支持select方式和降序升序切换](https://www.lol9.cn/uploads/allimg/20170822/1503405474170549-lp.gif)




















