`

织梦 内容替换和多表查询

阅读更多

内容替换的方法

{dede:field.body runphp='yes'}
if( strstr( @me,'src="' ) ){
	@me = str_ireplace('/uploads/', 'http://www.onestopweb.cn/uploads/', @me);
}
{/dede:field.body}

 

多表查询的方法

{dede:sql sql="SELECT dede_ask.id,dede_ask.title,dede_askanswer.content FROM dede_ask,dede_askanswer WHERE dede_ask.id = dede_askanswer.askid ORDER BY dede_ask.dateline DESC LIMIT 6"}
<li>
	<h3 onclick="window.open('[field:global.cfg_basehost/]/ask/[field:id/].html',target='blank')" style="cursor: pointer">[field:title function="cn_substr(@me,54)"/]</h3>
	<p>[field:content function="cn_substr(html2text(@me),96)"/]</p>
</li>
{/dede:sql}

 

这样,是可以满足一些特殊的需求。

 

 

 

 

1
0
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics