Create new Drupal 5.2 function & tag list template for YouCMSAndBlog |
Create New Drupal 5.2 PHPTemplate Engine Taglist & Functiion Taglist Some users are still confused how they can extend YouCMSAndBlog to support other templates & themes which are not listed / shipped in YouCMSAndBlog. In this tutorial, we will walk through how to do that for Drupal 5.2 Different from Joomla, Drupal provides few theme engine to be used.
For this tutorial, we will use PHPTemplate theme engine (Drupal default theme engine):- Create a new blank text file and name it as any name as you like to and for this tutorial I will use : drupal52-phptemplate.taglist.xml
- Copy and paste this source code and save the file. I will explain later on:
<taglist name="Drupal 5.2 PhpTemplate"> <tags> <tag> <label>Base Path</label> <value><![CDATA[$base_path]]></value> <description>The base path of the Drupal installation</description> <http-doc-address> <![CDATA[http://www.drupal.org]]> </http-doc-address> </tag> <tag> <label>Navigational</label> <value><![CDATA[$breadcrum]]></value> <description> Returns the HTML for displaying the navigational breadcrumbs </description> <http-doc-address> <![CDATA[http://www.drupal.org]]> </http-doc-address> </tag> </tags> </taglist>
- Create another new blank text file and name it as any name as you like to and for this tutorial I will use : drupal52-functions.taglist.xml
- Copy and paste this source code and save the file. I will explain later on:
<taglist name="Drupal 5.2 Functions"> <tags> <tag> <label>aggregator_admin_overview</label> <value><![CDATA[aggregator_admin_overview()]]></value> <description>Menu callback; displays the aggregator administration page</description> <http-doc-address> <![CDATA[http://api.drupal.org/api/function/aggregator_admin_overview/5]]> </http-doc-address> </tag> <tag> <label>aggregator_admin_refresh_feed</label> <value><![CDATA[aggregator_admin_refresh_feed()]]></value> <description>Menu callback; refreshes a feed, then redirects to the overview page</description> <http-doc-address> <![CDATA[http://api.drupal.org/api/function/aggregator_admin_refresh_feed/5]]> </http-doc-address> </tag> <tag> <label>aggregator_block</label> <value><![CDATA[aggregator_block()]]></value> <description>Implementation of hook_block()</description> <http-doc-address> <![CDATA[http://api.drupal.org/api/function/aggregator_block/5]]> </http-doc-address> </tag> <tag> <label>block_admin_display</label> <value><![CDATA[block_admin_display()]]></value> <description>Generate main block administration form</description> <http-doc-address> <![CDATA[http://api.drupal.org/api/function/block_admin_display/5]]> </http-doc-address> </tag> <tag> <label>block_admin_display_submit</label> <value><![CDATA[block_admin_display_submit()]]></value> <description>Process main block administration form submission</description> <http-doc-address> <![CDATA[http://api.drupal.org/api/function/block_admin_display_submit/5]]> </http-doc-address> </tag> <tag> <label>block_box_delete_submit</label> <value><![CDATA[block_box_delete_submit()]]></value> <description>Deletion of custom blocks</description> <http-doc-address> <![CDATA[http://api.drupal.org/api/function/block_box_delete_submit/5]]> </http-doc-address> </tag> <tag> <label>block_list</label> <value><![CDATA[block_list()]]></value> <description> Return all blocks in the specified region for the current user </description> <http-doc-address> <![CDATA[http://api.drupal.org/api/function/block_list/5]]> </http-doc-address> </tag> </tags> </taglist>
Taglist Template File structure From above example as you can see in fact it is very self explanatory. Taglist template file contains very simple structure:
<taglist name="your new editor name"> <tags> <tag> <label></label> <value><![CDATA[]]></value> <description></description> <http-doc-address><![CDATA[]]></http-doc-address> </tag> </tags> </taglist>
I am going to explain one by one below: - <tag>: Any new tag that you want to add, you can create a new <tag> element
- <label>: Label for each tag
- <value>: The real tag / function syntax for your template / theme to use, i.e. aggregator_admin_refresh_feed(). This is the value that will be inserted to YouCMSAndBlog editor once user double click on its list box located on the left side of the editor window.

- <description>: Descriptive information for this tag. It will display on status bar of YouCMSAndBlog editor or when user right click on particular tag list and select "Description"

- <http-doc-address>: This tag is very useful to link this particular tag to online documentation and normally you can point it directly to its official website, i.e. http://api.drupal.org/api/function/block_list/5
From YouCMSAndBlog editor, user can click on the respective tag / function and right click, select "Online Documentatio" and it will open Internet browser to access that particular http:// address which you have set before.

Modify YouCMSAndBlog Main Configuration File Okay so far you have created the templates (tag and function template). And now you are ready to install it manually by opening up & configuring the configuration.xml: - Open configuration.xml
- Copy and paste following code to below <editors> tag
<!-- Drupal 5.2 PHPTemplate --> <editor> <name>Drupal 5.2 PHPTemplate</name> <!-- you must specify at least one keyword in order for IDE to recognise the file type is Drupal 5.2. You can specify more than one by using comma as delimitter --> <keyword>$site_name, $secondary_links, $sidebar_right</keyword> <ico></ico> <tag-template-path>drupal52-phptemplate.taglist.xml</tag-template-path> <!-- You can add & modify syntax code coloring here --> <!-- Your own defined template may have keyword to put here. I put few keywords here only --> <syntaxcolor-keyword> <![CDATA[base_path, block_box_form]]> </syntaxcolor-keyword> <!-- so far, below customised regular expression only to coloring HTML tag or XML tag . You are free to extend it more to support more other sort of tags with Alternate in Regular expression to support Drupal tag--> <syntaxcolor-re-pattern> <![CDATA[</?\w+((\s+\w+(\s*=\s*(?:".*?"|'.*?'|[^'">\s]+))?)+\s*|\s*)/?>]]> </syntaxcolor-re-pattern> <syntaxcolor-comment-re-pattern><![CDATA[]]></syntaxcolor-comment-re-pattern> <trueview-http>http://localhost/drupal52</trueview-http> </editor> <editor> <name>Drupal 5.2 Functions</name> <keyword>$site_name, $secondary_links, $sidebar_right</keyword> <ico></ico> <tag-template-path>drupal52-functions.taglist.xml</tag-template-path> <syntaxcolor-keyword> <![CDATA[base_path, block_box_form]]> </syntaxcolor-keyword> <syntaxcolor-re-pattern> <![CDATA[</?\w+((\s+\w+(\s*=\s*(?:".*?"|'.*?'|[^'">\s]+))?)+\s*|\s*)/?>]]> </syntaxcolor-re-pattern> <syntaxcolor-comment-re-pattern><![CDATA[]]></syntaxcolor-comment-re-pattern> <trueview-http>http://localhost/drupal52</trueview-http> </editor>
- Save it
- Launch YouCMSAndBlog Editor
- For configuration.xml, it is also very descriptive:
- <editor>:The new editor you are going to link to your new taglist template file
- <name>: This name will be displayed on YouCMSAndBlog main select Template Name dropdown box

- <keyword>: Using comma delimitter to separate the keywords. It is used by YouCMSAndBlog to detect which Editor to be used to access True View mode, Syntax Color, etc once you loaded your template file to edit. So this element is very important to be specified
- <tag-template-path>: Have to correspond to the template / function list you just created
- <syntaxcolor-keyword>: Nah, this element is different from previous <keyword> element. With this element you can list down as many keywords as you want YouCMSAndBlog editor to highlight in difference color (syntax color) for you when you are editing your template for this particular template (i.e. Drupal in this case).
- <syntaxcolor-re-pattern>: This one is the most powerfull yet I have the less knowledge of it (lol). It just works like <syntaxcolor-keyword> element but the difference is you are using Regular expression to control the highlighting. You can use all your knowledge about Regular Expression here to control its syntax color.
Ok, that's all for now.
|