As the saying goes, it's good to own hands!
Today realizes this, takes out to share with the novice, the great god please detour!
Full post code:
<!--{eval $slides = Db::fetch_all ("select * from ' pre_common_block_item ' WHERE ' bid ' =15 ORDER by ' displayorder ' ASC, ' ID ' DESC LIMIT 0, 10 ');} -
<!--{Loop $slides $slide}-->
<a href= "$slide [url]" target= "_black" ></a>
<!--{/loop}-->
Copy Code
Code parsing:
<!--{eval $slides = Db::fetch_all ("//Execute SQL statement
SELECT *//Read all fields
From ' Pre_common_block_item '//Data sheet can be customized this is a DIY post content table
WHERE ' bid ' = 15//Query criteria bid is a DIY module ID
ORDER BY ' Displayorder ' ASC, ' id ' DESC//Sort condition
LIMIT 0, 10//Get the top 10 message
");} -
<!--{Loop $slides $slide}-->//Loops $slides array use $slide [field name] to get content
<a href= "$slide [url]" target= "_black" ></a>
<!--{/loop}-->
Hope to be able to help new people! Explanation is not in place also please understanding, welcome criticism correct, do not like to spray!
Use eval and loop to read the contents of the database directly in the template and output