Extreme Drupal Theming with PHPtemplate
Drupal's phptemplate is the most powerful, simple, and flexible templating/theming system on the planet*. Yet, it seems that the majority of drupal themers, (and wannabe drupal themers) are ignorant of its true power.
More disturbingly, vast numbers of people still insist that Joomla!, typo3, and wordpress's templating systems are easier, sexier, and slicker. These people are either loony, or wrong.
As an expert in PHPtemplate (isn't that scary), I've decided its my duty to show the true power of PHPtemplate to world.
Consider these tutorials, a proper (and steadily growing) introduction to drupal's templating system.
*by all means, prove me wrong if you disagree.
Awesome
Good call amigo. I guess I'm the first to submit this to Stumble, so expect another hundred uniques a day (I think).
You're welcome.
*by all means, prove me wrong if you disagree.
Heehee Nick, the burden of proof is on YOU. And remember: extraordinary claims demand extraordinary proof ;-)
Vis a vis Wordpress
Theming and taxonomy
A typo?
Nice - some suggestions
theme_foo() functions in your theme. You can also theme any form, including one that doesn't have a theme_form_foo() function (i.e. you can override the theming of a form, even if there's no default theme function to be overridden for it). This is probably not obvious to many Drupal themers, especially those that are used to the limits of 4.6 theming.
However, I have a few suggestions:
1. Themers can also output nodes directly in their theme with a call to node_view($node), or with a call to theme_node($node). This is preferable to directly printing the node title and body, unless you really need the extra flexibility.
2. node_view() wraps the title of the node in a call to check_plain(). So any method that bypasses this function (including calling theme_node(), or printing the title directly), should use check_plain() before printing the node title. Failing to do this will open a potential security hole in your site.
3. I'm not a big fan of hard-coding node IDs, even in a themable function. IMO, themers should instead use variable_get(), even if there's no front-end interface for changing the variable in question (you can at least develop one later if necessary).
Hey!..Thanks..
Thank you for he nice tutorial. Keep it up man
-Nish