[themes] Example phptemplate theme
Tao Starbow
starbow at citris-uc.org
Mon Dec 5 23:29:01 UTC 2005
Darrel O'Pry wrote:
>On Mon, 2005-12-05 at 16:03 -0500, Rowan Kerr wrote:
>
>
>>On 12/5/05, Tao Starbow <starbow at citris-uc.org> wrote:
>>
>>
>>>Is there a documentation page somewhere that lists/describes all the
>>>methods of $node that can be accessed in a template?
>>>
>>>
>>http://drupal.org/phptemplate and http://drupal.org/node/11816
>>
>>Basically, the entire node object is available from a node's
>>phptemplate file, but I'm not sure how many of drupal's functions are.
>>
>>
>
>Most everything is there.. Objects in drupal pretty much only use
>properties, so you won't be finding any node methods....
>
>You can try a '<pre>' . print_r($node, true). '</pre>' to see what all
>is in the node.
>
>If you want to see all the function availble from within php template
>you can try some of php's introspection functions.
>....
>
><ul>
><?php
>$functions = get_defined_functions();
>foreach($functions['user'] as $function) {
>?>
> <li>$function</li>
><?php
>}
>?>
></ul>
>
>...
>
>you can also use get_defined_vars and get_defined_constants, etc...
>
>
Thanks, that a great way to find the stuff left off the documentation at
node/11816.
I had to fiddle just a bit with your examples to get them to work from
inside a sample node.tpl.php file
<!-- All node properties -->
<pre>
<?php print_r($node, false) ?>
</pre>
<!-- The Drupal API as seen from the template -->
<ul>
<?php
$functions = get_defined_functions();
foreach($functions['user'] as $function) {
?>
<li><?php print $function ?></li>
<?php
}
?>
</ul>
More information about the themes
mailing list