forum list output

-Calypso-

Member
Ok, been trying to rundown where the output is for the main forum list (index.php?/forum.php?), I thought I found it but apparently not. I found the node_forum_level_2 template, from there looks like it's a branch off of forum_list template. So I find the $viewParams for the forum_list template, I see that in the array is $forum. Right above the $viewParams I put
Code:
$forum['foo'] = "bar";

I then add {$forum.foo} to the node_forum_level_2 template and nothing is displayed, what am I doing wrong?

Thanks
 
For the forum home (forum-list) page:

- Page-level template: forum_list
- Controller class: XenForo_ControllerPublic_Index
- Action method: actionIndex


Adding $forum['foo'] just before the viewParams won't include that variable in the templates because the $forum variable is not directly included in the view parameters. You'll have to either (1) include the variable inside the $viewParams itself, or (2) look for another location to hook into, depending upon what you want to achieve.
 
A forum is a node. Just like a category, page, and a redirect link-forum. Each of these node "types" have a node handler, which decides how a node is rendered.

XenForo_NodeHandler_Forum::renderNodeForTree()

...passes the node information to the template in the form of a "$forum" variable.
 
I get that part, let's say I add the field 'test' to the forum table and edit forum 1 with the text "foo", I can go to node_forum_level_2 template and put {$forum.test} in and it displays "foo", however in the file just above viewParams which has $forum in the viewParams, I can put $forum['test'] = "foo"; and it nothing is displayed.
 
I take it you want to dynamically add a key to the $forum array (which gets rendered in a node_forum_level_* template) ?
 
for now yes, i also see in the node_forum_level_2 template that it has "node forum level_{$level}", guessing that level 0 would be the index, 1 would be category.
 
for now yes
Extend the "XenForo_Model_Forum" model class; and override the prepareForum() method. This is the ideal place, IMO, for adding any keys to the $forum array. Core xenforo itself utilizes this method for adding the "hasNew" key.

i also see in the node_forum_level_2 template that it has "node forum level_{$level}", guessing that level 0 would be the index, 1 would be category.
A "level" denotes the nesting level of a node in a node tree.
Categories have their own node_category_level_* templates, though.
 
A "level" denotes the nesting level of a node in a node tree.
Categories have their own node_category_level_* templates, though.

Therein lies the confusion, if forum categories have their own then what is the purpose for the forum_{$level}? This is completely different than any other forum system code I have seen so I don't just automatically know or understand it yet.
 
forum categories
Here's where XF differs from some other forum softwares. A "category" node is completely different from a "forum" node. Calling it a "forum category" only adds to the confusion. Different node types, different rendering processes. :)

Therein lies the confusion, if forum categories have their own then what is the purpose for the forum_{$level}? This is completely different than any other forum system code I have seen so I don't just automatically know or understand it yet.
A level denotes where a node is displayed in a node tree. This level is calculated relatively.
Wait a moment... I'm preparing an illustration which should make it clear for you.
 
On a forum-list page:

node_tree_levels.webp

I haven't tried any of the crazy nesting configurations myself, like a page inside a category inside a forum inside a forum inside a category; so I can't confirm how it would behave under those conditions.
 
I haven't tried any of the crazy nesting configurations myself, like a page inside a category inside a forum inside a forum inside a category
I have :D

It all seems to work quite well now that level 2 nodes aren't displayed at the same level as their parent (I reported this as a bug before Beta 6).

nesting.webp

The actual parent node is a category but it's not displayed as it's way up the page.
 
Top Bottom