Hello there! I need to customize the output for comments and blocks in my site. I'm using phptemplate, but I don't know which variables are available to print the dynamic content, like $title, $body, etc. Somebody could tell me where can I find some example templates for this sections, comment.tpl.php and block.tpl.php?

Otherwise, how can I show all local variables that exists in the execution environment of the script (if posible), so I can see where is this content.

Comments

adrian’s picture

for block.tpl.php

    $template->set_vars( array(
      "block"   => $block
    ));

for comment.tpl.php
[? $template->set_vars( array(
"comment" => $comment
));
?]

carlosparamio’s picture

I have the following on block.tpl.php:

print_r($block)

So I can show all the values on that array. Ok, but if I try the same for comment.tpl.php:

print_r($comment)

it doesn't print nothing.

Ok, I was reviewing the code of phptemplate.php, and I think this is the problem:

 if (file_exists("$template_path/comment.tpl.php")) {
    $template = &new Template("$template_path");
    $template->set_vars( array(
      "block"   => $block // <-- probably this was a copy/paste, and it must be substituted with "comment" => $comment
    ));
    $output = $template->fetch("comment.tpl.php");
  }

Now I can access to the $comment array.

Thanks for guide to me!