(Plug in introductionFor a long time, emlog has taken a lightweight route and does not integrate template background settings. Therefore, many powerful templates need to modify files to change settings. Well, with this plug-in, you don't have to be so tangled. The plug-in can be developed in the background according to this specification.How to make the plug-in recognize the template?Set options PHP is placed in the template directory. The content format is as follows. You can add any setting item. Note the $options variable and comments:<? php/*@support tpl_ Options*/! Defined ('emlog_root ') & & exit ('Access rights defined!');$option = array('sidebar '= > array('type '= >' radio ','name' = > 'sidebar position','value' = > array('left' = > 'left','correct' = > 'correct'),'default '= >' correct ',),'sorticon '= > array('type '= >' image ','name' = > 'classification icon settings','value' = > array(Template URL. ' Image / star png',),'dependency '= >' sort ','not sorted' = > really,'description '= >' set different small icons for different categories, preferably 20 × 20',),);In options What should each element write in PHP?As shown in the figure above, in the $options array, key is the ID of the setting item and value is the array containing multiple elements. The type attribute and name attribute are required. Name is the name of the setting item, and type is used to specify the type of the setting item. The supported types are as follows:Radio: radio buttonCheck box: check buttonText: TextPicture: picturePage: pageSorting: sortingLabels: labelsSpecifies the default value for all attributes. When default is not specified, the first value in values is used. If neither is specified, a strange default value is used.For radio and chexkbox, the values attribute is used to set the value and display name of each button.In addition to sort, you can specify depend as sort, that is, this option can set different values according to different categories. When a dependency is specified as sort, you can select an unsorted attribute. When it is true, it means that it contains unsorted and does not contain false. The default is true.Sort and page can set the multi attribute to true, indicating multiple choices.The description attribute is optional and is used to describe the options.If the type is text, the multi attribute can be set to true, indicating the difference between input and textarea. The optional property rich is used to support rich text. If this value is set, the editor loads.If the type is sort, page or tag, and multiple selections are set, the default value is empty; otherwise, it is the first value of the type.How to call a setting item in a templateThe plug-in provides a simple method*_ G ($key), as in the above example, can be used_ G ('sidebar ') get the setting of the sidebar. The value is 0 or 1. Use_ G ('sorticon ') to get all the settings of the category icon, use_ G ('sorticon. 1 ') the array with category ID as the key gets the sorticon with category ID of 1 (if any). It should be noted that for the page type, the page ID, sorting type, category ID, tag type and tag name will be obtained. If no parameters are passed, all settings are used_ G () method. For the migrated old template, you can use extract (_g())* Replace the original load options file.)