Please upgrade here. These earlier versions are no longer being updated and have security issues.

$Categories not fully populated in "themes/customtheme/views/categories/all.tpl"

codegruntcodegrunt New
edited January 2011 in Vanilla 2.0 - 2.8
I am currently working on moving PHP based layout to Smarty template files where possible for easier manipulation and maintenance. I have started with "themes/[themename]/views/categories/all.php" by creating a new file called "all.tpl".

The docs are light on what is available as far as variables go so I started by using the following Smarty function to see what all was available:

{debug}

This shows that the following variables are present:

{$Assets}
{$BodyClass}
{$BodyID}
{$Path}
{$SCRIPT_NAME}
{$Title}
{$User}
{$Categories}

$Categories is of course an array of the categories but it is not fully populated as far as I can see. Here is what is available for an example sub-category in the list:

4 => Array (18) Name => "Films and Videos" CategoryID => "17" TreeRight => "13" TreeLeft => "8" Depth => "1" Description => "" CountDiscussions => "0" CountComments => "0" UrlCode => "films-and-videos" LastCommentID => null DateLastComment => null LastCommentUserID => null LastCommentName => null LastCommentPhoto => null LastDiscussionID => null LastDiscussionName => null CountAllDiscussions => 2329 CountAllComments => 0

Although there are 2329 discussions present, a good portion of the expected values have not been set. This greatly limits what can be done with the template. For example, there is no way with this structure to list who made the last comment under a category when using a Smarty template. Any know if this is a bug or is it a limitation of the system?

This functionality is supported with the PHP approach because that directly iterates through the $Category object. With the Smarty version, we are limited to what has been assigned to Smarty wherever that happens in the code.

Any help appreciated.

Cheers
Tagged:
Sign In or Register to comment.