What Functions Are Available In A Drupal PHPTemplate Theme?
Sponsored Links
What Functions Are Available In A Drupal PHPTemplate Theme?
Submitted by Khalid on Mon, 2005/12/05 - 17:55Darrel O'Pry posted this gem on the Drupal Themes mailing list, and it deserves to be publicized.
Paste this in your page.tpl.php below the <body> tag, to see what functions are available for you, the theme developer.
<ul>
<?php
$functions = get_defined_functions();
foreach($functions['user'] as $function) :
print "<li>$function</li>";
endforeach;
?>
</ul>
Similarly, one can use the get_defined_vars() and get_defined_constants() to see what variables are available.
Now, use your imagination and build nice themes ...
»




List all themeable functions
If you only want to list all themeable functions available try this:
< ? php- $function
- ";
$functions = get_defined_functions();
foreach($functions['user'] as $function):
if (strpos($function,'theme_') === 0):
print "
endif;
endforeach;
? >
Module?
This code would make a handy module
Hey, it works in a node!
I've posted this code in a node for that on-the-go sort of reference.
List of themeable functions for Drupal 4.6.x"
Post new comment