XF 2.0 Equivalent of <a href="{xen:link forums/87/}">GAMES</a> in XF2

If you had an forum object, you could do this:
HTML:
{{ link('forums', $forum) }}
This would build the link like /forums/forum-name.ID based on the info in the $forum object.
 
This will work for you :)

HTML:
<xf:set var="$myforum.title" value="blabla" />
<xf:set var="$myforum.node_id" value="4" />

{{ link('forums', $myforum) }}

You just have to change title and node_id.
 
Last edited:
I have like 20 forum target links, do I need to create xf:set for all of them?
If you don't want to write PHP code and if there's no shorter way (see my question above), then: yes.

Tough you can just set a node_id and no title, wich will result in URLs like /forums/4/ instead of /forums/blabla.4/
 
sure:

HTML:
<xf:set var="$myforum.1.title" value="1st forum" />
<xf:set var="$myforum.1.node_id" value="1" />
<xf:set var="$myforum.2.title" value="2nd forum" />
<xf:set var="$myforum.2.node_id" value="2" />
<xf:set var="$myforum.3.title" value="3rd forum" />
<xf:set var="$myforum.3.node_id" value="3" />

{{ link('forums', $myforum.1) }}
{{ link('forums', $myforum.2) }}
{{ link('forums', $myforum.3) }}
 
Hi, we just upgraded XF1 to XF2, and having a hard time figuring template equivalents.

We've been had this <a href="{xen:link forums/87/}">GAMES</a> and the output usually https://www.forum.or.id/forums/87/

Since upgraded to XF2, this no longer working, how can we make it work again? preferably with the forum name as well, f.e. https://www.forum.or.id/forums/GAMES.87/ something like that.

Any input would be appreciated.

Cheers!
@Mike or @Jake Bunce : do you have a better solution for this?
 
An old question that I have solved with
Code:
<a href="/forums/87/}">GAMES</a>

But I also would like another quick, simple and smart way to also automatically get the forum name in the link from the forum id?
 
Top Bottom