Home > Article > CMS Tutorial > What is the principle of dedecms
dedeCMS content management system has the largest user base in China with its superior performance, stability and powerful functional advantages. Today we analyze this powerful content How the management system's template engine works.
The Dreamweaver template engine is a template parser that uses XML namespaces. The biggest advantage of using the Dreamweaver parser to parse templates is that you can easily specify the attributes of the tag, and it feels like using HTML. , the template tag code is concise, easy to use, and easy to understand. The new version of the Dreamweaver template engine can not only parse the template but also analyze the wrong tags in the template.
1. The code styles of the Dreamweaver template engine have the following forms:
{dede: tag name attribute='value'/}
{dede:Tag name attribute='value'}{/dede:Tag name}
{dede:Tag name attribute='value'}Underlying template (InnerText){/dede:Tag name}
Tips:
If you use a tag with an underlying template, you must strictly use the format {dede: tag name attribute = 'value'} {/dede: tag name}, otherwise an error will be reported.
2. The Dreamweaver template engine has multiple built-in system tags, and these system tags can be used directly in any situation.
(1) global mark, indicating to obtain an external variable , which can call any configuration parameters of the system in addition to the database password, in the form:
{dede: global name='variable name'}{/dede:global}
or
{dede:global name='variable name'/}
The variable name cannot be added with the $ symbol, such as the variable $cfg_cmspath, which should Written as {dede:global name='cfg_cmspath'/}.
(2) foreach is used to output an array, The form is:
{dede:foreach array='array name'}[field:key/] [field:value/]{/ dede:foreach}
(3) include introduces a file in the form:
{dede:include file='file name' ismake='whether it is a dede section template (yes/no) '/}
The search path for files is in the order: absolute path, include folder, CMS installation directory, CMS main template directory
3. The Dreamweaver tag is allowed to be used in any tag The function processes the obtained value, in the form:
{dede: tag name attribute='value' function='youfunction("Parameter One","Parameter Two","@me ")'/}
Where @me is used to represent the value of the current tag, other parameters are determined by your function, for example:
{dede:field name='pubdate' function='strftime("% Y-%m-%d %H:%M:%S","@me")'/}
4. The Dreamweaver mark allows limited programming expansion.
The format is:
{dede:tagname runphp='yes'} $aaa = @me; @me = "bbscms.net"; {/dede:tagname}
@me represents the value of the tag itself, so statements such as echo cannot be used in programming within the tag, only Pass all return values to @me.
In addition, because the program code occupies the content of the underlying template InnerText, the tags that require programming can only use the default InnerText.
If you want to know more about dedecms, you can click: DEDECMS tutorial
The above is the detailed content of What is the principle of dedecms. For more information, please follow other related articles on the PHP Chinese website!