AndyB
Well-known member
Some forums use the "Include Content Title in URLs" and some don't. I would like my add-on to create a link for either situation.
In one of my add-ons, I would like to include a link to a forum. How would I code the xen:link to take into account the option of "Include Content Title in URLs".
This template example works fine if the "Include Content Title in URLs" is NOT checked.
How would I change this code so that if will include the "Title in URLs".
Can this be done at the template level? Or do I need to pass in a variable with the TitleURL, if so what is the PHP code?
Thank you.
In one of my add-ons, I would like to include a link to a forum. How would I code the xen:link to take into account the option of "Include Content Title in URLs".
This template example works fine if the "Include Content Title in URLs" is NOT checked.
Code:
<xen:foreach loop="$posts" value="$post">
<xen:if is="{$xenOptions.includeTitleInUrls} == 0">
<a href="{xen:link 'forums/{$post.forum_id}'}" />{$post.forum_title}</a>
</xen:if>
<xen:if is="{$xenOptions.includeTitleInUrls} == 1">
<a href="{xen:link 'forums/{$post.forum_id}'}" />{$post.forum_title}</a>
</xen:if>
</xen:foreach>
How would I change this code so that if will include the "Title in URLs".
Code:
<xen:if is="{$xenOptions.includeTitleInUrls} == 1">
<a href="{xen:link 'forums/{$post.forum_id}'}" />{$post.forum_title}</a>
</xen:if>
Can this be done at the template level? Or do I need to pass in a variable with the TitleURL, if so what is the PHP code?
Thank you.
Last edited: