Dedecms php statement guide, dedecmsphp statement guide _ PHP Tutorial

Source: Internet
Author: User
Dedecms uses the php statement guide and dedecmsphp statement guide. Dedecms php statement Guide. dedecmsphp statement guide in DEDECMS, if php statements are used, the {dede: php} tag can be used, the simplest input is the guide to using php statements in dedecms by copying code, and the dedecmsphp statement guide.

In DEDECMS, php statements can be used with the {dede: php} tag. the simplest input is as follows:

The code is as follows:


{Dede: php}

$ NumA = 1;

$ NumB = 2;

Echo $ numA + $ numB;

{/Dede: php}

From the preceding statement, we can see that the dede: php tag can be used in the same way in php. the above statement is written in php as follows:

The code is as follows:


<?
$ NumA = 1;
$ NumB = 2;
Echo $ numA + $ numB;
?>

Does it look a lot like it? let's look at another judgment using the if else condition.

The code is as follows:


[Field: global runphp = 'yes' name = autoindex]
$ A ="";
$ B ="";
$ C = "<(www.jb51.net) SPAN class = 'num'> ";
If (@ me> 3) @ me = $ c. @ me. $ B;
Else @ me = $ a. @ me. $ B;
[/Field: global]

I will not write this code in php. next we should look at the use of SQL labels combined with dede php labels.

Query and output single content in combination with SQL

The code is as follows:


{Dede: php}
$ Row = $ dsql-> GetOne ('select id, typename from dede_arctype where id = 2 ');
Print_r ($ row );
{/Dede: php}

The output content is

The code is as follows:


Array
(
[Id] => 2
[Typename] => Q &
)

Isn't it easy? if you need to learn, please refer to this article.

In DEDECMS, if you use a php statement, the {dede: php} tag can be used. the simplest input is code...

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.