The method of adding php Code into Dream Weaving dede template
This article is about how to add php code to the dream weaving dede template. The editor thought it was very practical, so I shared it with you as a reference. Let's follow the editor and have a look.
Dream weaving dede template how to add php code?
1. Embed php in the template page
Recommended study: dream weaving cms
For example:
{dede:name runphp='yes'} $str = "hello"; @ me = $str; @ me. = "world" {/ dede:name}
The final output is hello world
In fact, "name" is an arbitrarily defined name, and the value after "@ me=" is the final value for output, so I'll use it instead of echo. (if you directly use echo, an error is reported when the template is generated, which is the limit, alas).
Second, quote php files
If you want to use PHP in include files, add source='value'
{dede:include runphp='yes' source='value' file=''/}
The specifications written by PHP are:
There is no need to add symbols in PHP coding.
Second, if you want to deal with the value of the current tag (the first case above), use @ me to indicate the current value
Third, if you directly introduce PHP and want to get the running value, you must use $DedeMeValue to represent the final value returned after running the PHP (so you can't use HTML mixed writing).
For example:
{dede:field runphp='yes'} $aaa=200;$DedeMeValue=100;$DedeMeValue + = $aaa; {/ dede:field}
Equivalent to:
{dede:field runphp='yes'} $aaa = 200 aaa;; metrology 100 percent me + = $aaa;; {/ dede:field}
The final returned result is: 300
For example: {dede:list perpage='10'}
[field:id runphp= "yes"] $dsql = new DedeSql (false); $a = "select a.address FROM xudaoshan_addonarticle as a where a.aid=@me"; $arcRow = $dsql- > GetOne ($a); @ me=''.$ arcRow.'; [/ field:id] {/ dede:list} Thank you for reading! On the dream weaving dede template to add php code to share here, I hope the above content can be of some help to you, so that you can learn more knowledge. If you think the article is good, you can share it and let more people see it.