158 CHAPTER 5 ADDING AND (Hosting web) CUSTOMIZING THEMES
158 CHAPTER 5 ADDING AND CUSTOMIZING THEMES Theme engine s namespace: If the bluemarine namespace doesn t provide a function to theme foo, then Drupal looks to the theme engine namespace next. Assuming that Bluemarine is the active theme, the engine s namespace is phptemplate, as Bluemarine is a PHPTemplate theme. The function that Drupal will look for is therefore called phptemplate_foo($bar). Default namespace: Finally, if the function is not found in the engine s namespace, Drupal will use the default namespace, which is theme. A function named theme_foo($bar) will be called, and this is the function provided by the core include file or module. Thus, you can see that the default implementation of any themable function must begin with the prefix theme_. The active theme s own namespace is rarely used to override functions. You will not find many examples of bluemarine_foo, bluemarine_breadcrumb, and so on. Rather, you will see functions in the engine s namespace being written in the theme files. Anyone overriding a themable function is encouraged to take the engine s namespace to name the override functions. A strong and simple case can be made for this practice: if you want to move the function to a different theme or reuse it in some other way, you won t need to rename the function. Sticking with this policy will also allow you to copy whole theme directories and rename the directory, perhaps as the first step in creating a new theme. For the rest of the chapter, I will choose the option of naming themable functions after the theme engine and will not use the active theme s namespace. Note Pure themes (Chameleon) the themes that don t rely on an external theme engine are the exception to the advice of not using the active theme s namespace. If you need to override a theme function and you are using the Chameleon theme, you must use the Chameleon namespace. Table 5-3 shows some examples of common themable functions, what they would be named if overridden in the Bluemarine theme, and how they are evoked (parameters omitted). Table 5-3. Examples of Overriding Themable Functions in the Bluemarine Theme Default Version Bluemarine Version Invocation theme_links() phptemplate_links() theme(’links’) theme_submenu() phptemplate_submenu() theme(’submenu’) theme_xml_icon() phptemplate_xml_icon() theme(’xml_icon’) Exercise 5-1 demonstrates how to override a themable function.
Note: If you are looking for best quality webspace to host and run your tomcat application check Vision virtual web hosting services