XF 2.2 Using different "prefix" phrase for one specific forum

EchoRomeo

Active member
Hi everyone,

I figured out how to change the prefix phrase text that appears automatically in the prefix drop down box (i.e., using "prefix" phrase). This is great for most of my forums but for one forum I'd really like to display alternative "prefix" phrase text. Does anyone know if it's possible to override the "prefix" phrase with text differing from that specified in the ACP for one specific forum?

Thanks!
 
You would have to edit the template and use a conditional statement utilising the node ID.

Got it, thanks. I'll poke around and try to figure it out. This probably involves the page_container or forum_list template, right? Also not sure what form the conditional statement would take (only experienced in VB before this). If you have further guidance, I'm all ears. I may circle back after trying if I'm still not able to sort it out. Thanks!
 
For the page you want to change the wording on, use the browser console to check the template name and data container key ID.

This forum for example is forum_post_thread and node-47.

1687996502887.webp

I'm not sure exactly what you are trying to do but you would edit the forum_post_thread template and use a statement to check if the node ID is XX and change the phrase.
 
For the page you want to change the wording on, use the browser console to check the template name and data container key ID.

This forum for example is forum_post_thread and node-47.

View attachment 287808

I'm not sure exactly what you are trying to do but you would edit the forum_post_thread template and use a statement to check if the node ID is XX and change the phrase.

Great, thanks. The forum I'm looking to change the prefix phrase for is at https://www.permittingtalk.com/forums/general-permitting-discussion.1121/. I want the prefix phrase text on this page to be "Permit Type". Based on looking at the source code, I understand I want to edit the forum_view template.

In the forum_view template, it looks like I want to put the conditional statement around the following line of code:

<span class="filterBar-filterToggle-label">{{ phrase('prefix:') }}</span>

If I want the prefix phrase for the subject forum (node 1121) to be "Permit Type", then would the solution be something like the following:

<xf:if (data-container-key=1121)>
<span class="filterBar-filterToggle-label">{{ "Permit Type" }}</span>
<xf:else>
<span class="filterBar-filterToggle-label">{{ phrase('prefix:') }}</span>
</xf:else>
</xf:if>

I'm just making an educated guess as to what some of the code could be for the conditional statement. I really appreciate any further input you can provide!
 
Last edited:
Also tried the following using JavaScript. I think I'm on the right track but the "if" statement doesn't appear to register. Am I supposed to refer to the node ID using "data-container-key"? Thanks!

If (data-container-key=1121) {
<span class="filterBar-filterToggle-label">{{"test"}}</span>
} else {
<span class="filterBar-filterToggle-label">{{ phrase('prefix:') }}</span>
}
 
Top Bottom