XF 2.2 Forums Title + Breadcrumb local Category

claudiucjc

New member
Hello, I countinue with my issue from this topic in here because there main issue is solved https://xenforo.com/community/threads/category-or-prefix-next-to-the-forum-title.191776/

But now the second issue is I would like to we this code:


HTML:
<xf:if is="!$noH1">
<xf:if is="$containerKey == 'node-1'">
<xf:set var="$firstBreadcrumb" value="{$breadcrumbs|last}" />
<h1 class="p-title-value">{$h1}{{ ' | '.$firstBreadcrumb|first }}</h1>
<xf:else />
<h1 class="p-title-value">{$h1}</h1>
</xf:if>
</xf:if>

for all my nodes in that category.

Example my category node-1 have more categories with sub-forums.
If I the above code it will work just for node-1 but not for node-1 nodes.

How I can update the forums title just for all sub-forums located in node-1.
Here is my category unistudent.ro/universitati/ ... I would like to change the sub-forums title just in that category.
 
Change this:
HTML:
<xf:if is="$containerKey == 'node-1'">

to an array of the nodes you want it to apply to:
HTML:
<xf:if is="in_array($containerKey, ['node-1', 'node-2', 'node-3'])">
 
Change this:
HTML:
<xf:if is="$containerKey == 'node-1'">

to an array of the nodes you want it to apply to:
HTML:
<xf:if is="in_array($containerKey, ['node-1', 'node-2', 'node-3'])">
.
Is this affecting performance if I will add like 50 nodes in the array?

I was thinking I can do something else without adding every single node manualy. Anyway I will give a try just now.

1. Later edit: I was checking but I will have to add manualy more than 300 nodes.
And I was thinking like that I will not add the nodes manually but I would like to do a range of nodes for example from 0 to 600 AND if is forum_view the title have to changed just for the data-template="forum_view"

I kow how to explain the code in pseudo code but I don't know php (at the moment) and xenforo syntax.

And I think another way without using a loop for a range of numbers.

2. The code to be apply for the node less than(<) 600 AND nodes in data-template="forum_view"

@Brogan
do you think you can help me?
I know this can be posible with few lines of code but is the worst think when you don't know php and syntax :(
 
Last edited:
If all of the nodes have the same parent, this should work:

HTML:
<xf:if is="$forum.Node.parent_node_id == '1'">

If multiple parents:

HTML:
<xf:if is="in_array($forum.Node.parent_node_id, ['1', '2', 3''])">
 
If all of the nodes have the same parent, this should work:

HTML:
<xf:if is="$forum.Node.parent_node_id == '1'">

If multiple parents:

HTML:
<xf:if is="in_array($forum.Node.parent_node_id, ['1', '2', 3''])">
I edit my replay on top if you would like to have a look.
And it is another issue as well if the code is apply for category_view is still working ... but I would like to be applied just for forum_view

something like:
Code:
if forum_view AND forum.Node.parent_node_id < 600
   then change the forum_view title + breadcrumb
else
  don't change the title
 
Honestly at this point I'm just going to bail.

You have changed the requirements so many times - perhaps a clear concise request at the start would have been the way to go about this.
 
Honestly at this point I'm just going to bail.

You have changed the requirements so many times - perhaps a clear concise request at the start would have been the way to go about this.
Sorry if you think that ... maybe I wan't very clear because english is my second language.
Or another point is I want the forums titles to be changed JUST for ONE category but in that category I have another categories with sub-forums and in that categories, sub-forums I wolud like to change the title.

Sorry I can't express my self to be very clear ... I don't want to keep you busy just with my stuff.

You are right with the code $containerKey == 'node-1' this is my category where I want to change the forums titles but $containerKey == 'node-1' is doing just node-1 + breadcrumb is not going to the sub-forums title is stops just to that node.

Maybe I can express better if I say I wolud like to change the forums title for all childern forums in node-1.
Same like in CSS if I have:
<div node=1>
<div node=2>
<subdiv node=3>
<subdiv node=32>

</subdiv>
</subdiv>
</div>
</div>

And I'm doing div node=1 > subdiv { title + breadcrumb} I will change the title for all subdiv's in that div node=1

Hopefully you understand what I mean, I'm sorry I wasn't that clear at the beginning but I had the false impression everyone understand what I mean.
 
I'm very stubborn person and I don't like to give up.
I just need your confirmation @Brogan if my syntax is correct.
Solution:
Condition:
to be honest I don't know exactly what this $forum.Node.parent_node_id is doing.
HTML:
<xf:if is="$template == 'forum_view' AND $forum.Node.parent_node_id < '600'">

HTML:
                       <xf:if is="!$noH1">
                            <xf:if is="$template == 'forum_view' AND $forum.Node.parent_node_id < '600'">
                                <xf:set var="$firstBreadcrumb" value="{$breadcrumbs|last}" />
                                <h1 class="p-title-value">{$h1}{{ ' | '.$firstBreadcrumb|first }}</h1>
                                <xf:else />
                                <h1 class="p-title-value">{$h1}</h1>
                            </xf:if>
                        </xf:if>

To be more precise I would like to add one more condition
OR if node.name.value == "Universități".

How I can check for the node name value to use in the condition?
 
Last edited:
Top Bottom