Mytag| Custom Macro Tags
Label name: MyTag
Function Description: To get the contents of a custom macro tag
Scope of application: global use
Basic syntax:
{Dede:mytag typeid= ' 0 ' http://www.aliyun.com/zixun/aggregation/11696.html ' >name= '/}
Related functions:
File \include\taglib\mytag.lib.php Line 5th
Function Lib_mytag (& $ctag, & $REFOBJ)
Parameter description:
name = ' Tag ', which is a required property, and the following 2, 3 are optional attributes;
Ismake = ' yes|no ' defaults to the pure HTML code set by no, yes to the code containing the plate tag;
typeID = ' Indicates the ID of the column, default is 0, the display content of all columns, in list and document template, typeid default is the column ID of this list or document itself.
Usages:
In the template production, often encountered some site tags in multiple page calls, usually we can through the template {dede:include file= ' file name ' ismake= ' for Dede plate template (yes) '/} label import a file to solve, Head.htm in the DEDECMS version 5.3 Default template is introduced to other template files as such, it is then compiled into the header information of the page, but the way in which the file is introduced does not apply to the global display of a small amount of content, for example, you may have a column that needs to be displayed globally, and the call information for this column will change frequently. , but it only involves a piece of code, and if using {dede:include/} is difficult to implement, you need to customize the macro tag to solve this flexible invocation problem. In fact, the dream of the advertising plug-in is also a macro-tag another form of expression.
Before learning a custom macro tag, we'll look at the logo section of the Dream Help Center template, which describes how to use custom macro tags:
the following references:
Label name: MyTag
Feature Description: Used to get the contents of a custom macro tag
Scope of application: global use
Basic syntax: {dede:mytag typeid= ' 0 ' name= '/}
parameter Description:
name = ' Tag ', which is a required property, the following 2, 3 are optional attributes;
ismake = ' Yes|no ' is by default a pure HTML code defined by no, and yes is a code that contains a plate tag;
typeID = ' The ID of the column belongs to, the default is 0, the display of all the columns, in the list and document template, typeid default is the list or the document itself column ID.
There are 3 main steps to using a custom macro tag: Generate tags, add templates, and create content, and we'll explain how to use this tag from these processes.
Generate labels
The new version V5.3 adds custom macro tags that can be automatically generated and added to the Dream label, which is similar to the template fragmentation feature. The first is to add tags directly, you can click [Template]-[Custom macro tags] into the Custom macro tag Management page, add a label.
[Figure 1]
Here are a few parameters to introduce:
Columns: If not selected in all columns to display, if selected a column, only in the custom macro tag only in the currently selected column to display
Tag name: Used to differentiate the names of different tags, the proposed use of English and the collection of numbers
Normal display content: the content that the label is replaced when parsing, can be plain text, HTML, even the label of the Dream
If you choose aging can also control the display time of the label, so as to facilitate the unified management of these content, very convenient.
After the add we get the corresponding label, for example, our custom tag name is Diyinfo, then our label names are {dede:mytag name= ' diyinfo '}, if the label is HTML or plain text content can set the Ismake property is no, If you added a dream label, set the Ismake property to Yes.
The second method is to generate a label in the system [Template]-[Smart Tag Wizard] and save it as a custom macro tag, with the saved default file name Auto_x (x is the number, starting from 1) so that his tag code is {dede:mytag name= ' auto_1 ' Ismake= ' Yes '/}.
Of course, custom macro tag not only can be called by the form of Dream label, but also through the way of JS call, in the Custom Label Management page, each tag has a corresponding JS Generation Wizard, users can generate JS code inserted into the site template.
Join template
Custom macro tags can be added to the template of the first page, Channel page, list page, content page, the relative template file path in the Dream Help Center of the "main template file and function description" has been listed, modify the time can refer to join.
Content generation
If the custom macro tag uses a dream label to add to the template, you need to update all the content on the site periodically, but if you use the JS code in the template, you can use it all the time.
the following references:
Description: Dream label and JS is a custom tag of the two forms of invocation, the former is more suitable for the site to regularly update the whole station, and generated content directly nested to the build page, the latter is more suitable for a small number of updates to the site, but more convenient management. Here the advertising plug-in is actually a custom macro markup extension, the invocation form is somewhat the same.
So far, we have completed the study of custom macro tags, of course, there are many aspects of custom macro-tagging applications, look forward to more dream users to discover.