1. dede backend-& gt; system settings-& gt; basic system parameters-& gt; other options-& gt; remove the & quot; php & quot; tag from the "template engine disable tag" and save 1. basic usage:
{Dede: field. descriptionrunphp = 'yes'} if (@ me <> '') @ me =''. @ Me .'
'; {/Dede: field. description} {dede: field name = 'imgurls' alt = 'image output'} [field: pagestylerunphp = 'yes'] @ me = (@ me = 3? '': ''); [/Field: pagestyle] [field: title/] [field: pagestyle runphp = 'yes'] @ me = (@ me = 3? '': ''); [/Field: pagestyle] {/dede: field}
II. Advanced usage:
1. dede backend-> System Settings-> Basic System parameters-> Other Options-> remove the "php" tag in the "template engine disable tag" and save
2. use:
{Dede: php} echo 'php'; {/dede: php} {dede: php} $ result = mysql_query ("select * from bbs_forum_forum t1 left join bbs_forum_forumfield t2 on t1.fid = t2.fid where status = 1 and type = 'forum' order by t1.displayorder asc "); while ($ row = mysql_fetch_assoc ($ result) {echo'
'; Echo'
'; Echo'
| '; Echo ''; echo' | '; Echo'
'; Echo' '. $ Row ['name'].' ('. $ row ['threads'].') '; Echo''. $ Row ['description'].' '; Echo''. $ Row ['rules'].' '; $ Moderators = explode ("", $ row ['moderator']); $ moderators = implode (",", $ moderators); echo'Moderator: '. $ moderators .' '; Echo' | '; Echo'
| '; Echo'
'; Echo $ row ['threads'].'/'. $ row ['posts']; echo' | '; Echo'
'; $ Lastpost = explode ("", $ row ['lastpost']); echo ''. $ lastpost [1]. '('. $ lastpost [3]. ') '; Echo date ("Y-m-d H: I: s", $ lastpost [2]); echo' | '; Echo'
'; Echo'
';}{/Dede: php}
The above is the details about how to use the PHP sample code in Dede. For more information, see other related articles in the first PHP community!