Defining link parameters in template


Well-known member
Is is possible to define a link parameter as I have suggested below to set a title when creating a new thread. The code modifies the Post New Thread link to include a "title" parameter.

(Taken from the forum_view template.)

        <xen:set var="title">0</xen:set>
        <xen:if is="{forum.node_id} == 10">
          <xen:set var="title">title=A%20Test%29Title</xen:set>
    <xen:set var="$newDiscussionButton"><a href="{xen:link 'forums/create-thread', $forum, $title}" class="callToAction"><span>{xen:phrase post_new_thread}</span></a></xen:set>
The above code wouldn't work, but it is to illustrate what I'm trying to do. $title would only exist in some cases.

Chris D

XenForo developer
Staff member
The third parameter of the link builder accepts an array, or a simple string that is automatically converted to an array, so the correct syntax would be:

{xen:link 'forums/create-thread', $forum, 'title=Test title'}
It's not much different from what you already have, though, but really it should produce a link like this: