CHAPTER 5 ADDING AND CUSTOMIZING THEMES 157 (Hp web site)

CHAPTER 5 ADDING AND CUSTOMIZING THEMES 157 theme_node($node, $teaser = FALSE, $page = FALSE): Provides the HTML wrapper for the content of a node. Based on the $teaser parameter, this function will return either the truncated preview version of a node or the full version. The $page variable determines whether the node is being displayed on its own page or in a list of nodes, and usually controls whether or not the title is printed as a heading. The function also handles calling theme_links() for any links that are to appear along with the node, such as taxonomy terms and whatever links have been added by modules, such as comment or subscription links. theme_comment($comment, $links = 0): Handles the output of comments. This includes comments made to posts like blogs as well as comments in a threaded forum. Note that this does not handle the threading itself, just the HTML around the variable $comment. Whatever links are associated with the comment are expressed in the variable $links. theme_block($block): Gets called for each block region and wraps the block content in HTML. theme_box($title, $content, $region = ‘main’): Builds a generic container around content, usually with the use of

tags. The theme_page($content) function is responsible for generating the actual page that gets sent to the browser. It is the last function that is called when building a page. To invoke this function correctly (without calling it directly), use the syntax theme(’page’, $content). This tells Drupal that a themable function called page is to be called with the parameter $content. Drupal then starts looking for the appropriate function. How Drupal Finds Themable Function Overrides When a Drupal programmer wants to generate output by calling a themable function, he uses a special invocation that follows the pattern theme($function_name, [$params, …])(see the theme() function in includes/theme.inc) to call the function dynamically instead of calling it directly. For example, to call the appropriate themable function theme_foo, you would use theme(’foo’, $params…). Tip The theme() function is used to call all theme_foo functions in Drupal. For example, to call theme_foo($param1, $param2), use the syntax theme(’foo’, $param1, $param2). Drupal then looks in several places to see if a matching function is implemented and calls the first one that is found. It checks three areas, or namespaces, to find overrides to themable functions: Theme s namespace: The first place Drupal checks is the active theme s namespace. If Bluemarine is the active theme, the namespace is bluemarine. Drupal will look for a function called bluemarine_foo() and call it with whatever extra parameters were passed to theme(). If theme(’foo’, $bar)is the original call, and a function named bluemarine_foo is found, the call will be bluemarine_foo($bar).
If you are looking for cheap and quality webhost to host and run your website check Jboss Web Hosting services.

Leave a Reply