Steps to write PHP native code in {dede:sql} tag script

Source: Internet
Author: User
Please write PHP native code in {dede:sql} tag script!
{dede:sql sql= ' ... ' runphp= ' yes '}

echo ' Fuck ';

{/dede:sql}

How can I write php native code inside {dede:sql} tag script?

------Solution--------------------
Here are the PHP applications in Dede, which I hope will help you
Call tag: {dede:field name= ' keywords ' runphp= ' yes '}
if (!empty (@me)) {
$KWS = Explode (' ', @me);
@me = "";
foreach ($kws as $k) {
@me. = "$k";
}
@me = str_replace (' + ', ', trim (@me));
}
{/dede:field}
Dede the article content on the homepage
-------------------------------------------------
Method One: {dede:sql sql= "select Aid,typeid,body,body1, body2,body3,body4,body5 from
' Dede_addonarticle ' where typeid=2 ORDER by ' aid ' DESC LIMIT 0, 1 "}
[Field:body/] [Field:body1/] [Field:body2/] [Field:body3/] [Field:body4/] [Field:body5
/]
{/dede:sql}
Method Two: {dede:sql sql= "select Aid,typeid,body from ' dede_addonarticle ' where typeid=2 ORDER
By ' aid ' DESC LIMIT 0, 1 "}
[Field:body/]
{/dede:sql}
Call Description: Where typeid=2, column ID number, indicating that the call this ID column in the article, replaced by aid=1, which means that the call to the aid of 1
Chapter (specifically which article aid is how much, to go into the database to see, from the background to see also can), Desc, sort of, according to from the big to the small row, replaced by
ASC is ordered from small to large, limit 0, 1 for the number of calls, or as the number of limit 1, this 1 represents the number of calls.


List 5 lines plus a line:
{dede:list pagesize= ' 50 '}
  • Target=_blank>[field:title function= "Cn_substr (@me,)"/][field:pubdate
    runphp= ' yes '
    $a = "". Strftime ('%m-%d ', @me). "";
    $b =strftime ('%m-%d ', @me);
    $ntime = time ();
    $day 3 = 3600 * 24;
    if ($ntime-@me) < $day 3) @me = $a;
    else @me = $b;
    [/field:pubdate]

    [Field:global name=autoindex runphp= "yes"]
    if (@me%5==0) @me = " ";
    else @me = "";
    [/field:global]
    {/dede:list}

  • --------------------------------------------
    Latest article List "Alternate color" method
    {dede:arclist orderby=pubdate titlelen= ' row= ' 10 '}
    [Field:global runphp= ' yes ' name=autoindex]
    $a = "";
    $b = "";
    if ((@me%2) ==0) @me = $a;
    else @me = $b;
    [/field:global]

      • [field:title/]



    {/dede:arclist}
    --------------------------------------------
    Ad code:: {Dede:myad name= ' ad bit ID '/}
    The updated article time in 24 hours is shown in red:
    [Field:pubdate runphp= ' yes ']
    $a = "". Strftime ('%m-%d ', @me). "";
    $b =strftime ('%m-%d ', @me);
    $ntime = time ();
    $day 3 = 3600 * 24;
    if ($ntime-@me) < $day 3) @me = $a;
    else @me = $b;
    [/field:pubdate]
    Implementation of the "article title-Level 2 column-Level 1 column-site name" form
    {Dede:field name= ' title '/}-{dede:field name= ' position ' runphp= ' yes '}
    $TC = "-"; Separator
    $TW = $GLOBALS [' Cfg_list_symbol ']; Call Location delimiter
    @me =html2text (@me); Remove HTML tags
    $TF =split ($TW, @me); Decomposition of an array
    for ($ta = (count ($TF)-2), $ta >=1; $ta-) {//loop assignment to $TK
    $tk. =trim ($TF [$ta]). $TC;
    }
    $TK =substr ($TK, 0,-1);
    @me = $TK; [Email protected]
    {/dede:field}-{dede:global name= ' cfg_webname '/}

    Published articles show red dates or add new or new small pictures
    Articles published for nearly three days (or the same day) display red dates or add new or new small images.
    Are all around pubdate, write extensions.
    2nd, 3 to pay attention to the problem is: if: "Can not use double quotation marks, otherwise not."
    If you want to add to the day, change 3600 * 24 * 3 to 3600 * 24.
    1, ========== red date ========
    [Field:pubdate runphp= ' yes ']
    $a = "". Strftime ('%m-%d ', @me). "";
    $b =strftime ('%m-%d ', @me);
    $ntime = time ();
  • 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.