How to use PHP sample code in Dede

Source: Internet
Author: User
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'
        '; 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 $ row ['threads'].'/'. $ row ['posts']; echo''; $ Lastpost = explode ("", $ row ['lastpost']); echo ''. $ lastpost [1]. '('. $ lastpost [3]. ')
    '; Echo date ("Y-m-d H: I: s", $ lastpost [2]); 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!

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.