1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

How to tell what type of page? category, thread, etc.

Discussion in 'XenForo Development Discussions' started by mungo, Apr 5, 2011.

  1. mungo

    mungo New Member

    i want to know what type of page is being served.

    reason: i want to serve different content in the <head> depending on if the page is a category or a thread. basically i want the format of the title tag and also the description tag to be different depending on the type of page.

    i tried

    <xen:if is="{$forum.node_id}">
    <title>This is a forum node</title>
    <xen:else />
    <title>this is a thread or other page</title>
    </xen:if>

    but that is clearly wrong.

    additionally, if i'm on a thread page, what variable will tell me what the title of the forum that thread is in?
     
  2. mungo

    mungo New Member

    ok i've developed this further:

    <xen:if is="{$contentTemplate} == 'forum_list'">
    <title>{$xenOptions.boardDescription}</title>
    <meta name="description" content="my content here" />
    <xen:elseif is="{$contentTemplate} == 'forum_view'" />
    <title>{xen:raw $title}</title>
    <meta name="description" content="{xen:raw $pageDescription.content}" />
    <xen:elseif is="{$contentTemplate} == 'thread_view'" />
    <title>{xen:raw $title}, at example.com</title>
    <xen:else />
    <title><xen:if is="{$title}">{xen:raw $title} | {$xenOptions.boardTitle}<xen:else />{$xenOptions.boardTitle}</xen:if></title>
    </xen:if>

    the above all works fine, but i need to get the name of the forum that a thread is in.
    what variable do i need to use to get that.

    furthermore where can i find out what all possible values in the $head array could be -
    i've added {xen:helper dump, $head} to the bottom of the PAGE_CONTAINER template, but when calling any particular page only the keys which are set are displayed, not what keys could potentially be set.
    eg. on the forums page it shows: canonical, description and openGraph
    on an individual forum node page it shows: canonical and rss
    where do i find what all the potential keys are?
     

Share This Page