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

XF 1.4 Possible to Change Page Node <Title> Dynamically?

Discussion in 'Styling and Customization Questions' started by WearableTechForums.com, Dec 28, 2014.

  1. I have a page node that I control via an external PHP script via a callback. Even though the page node is in actuality many pages, due to the PHP script, the page title is always the same. Is there any way to control the <title> dynamically from my PHP script?
  2. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    The <title> can be set in the content template with this code:

    <xen:title>TITLE HERE</xen:title>
    The default content template for all page nodes is:

    Admin CP -> Appearance -> Templates -> pagenode_container

    For your purposes you probably want to use a callback to set a different content template so you can change the xen:title code for a specific page node. Here is a guide:

  3. Thanks—I was able to follow your directions until the last part, because I'm already using the includeFile callback function here. i.e. I can't specify two callbacks on one page node. Is there a solution to this?

    Also, I want to make sure we're on the same page that I'm looking to control the title from the PHP file I'm including.
  4. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    I can't be more specific in my instructions. Those are all of the programming tools available which can allow you to:

    1) Override the content template for a specific page node.

    2) Define the page title in that content template.

    Beyond that it is a programming problem that requires more specific questions if I am to help.

    Note that you can define template variables for use in the content template like this:

    $response->params['customTitle'] = 'Some title here';
    That would allow you to use this in your content template:

  5. Thanks! Based on the various instructions you've provided across the site, I was able to figure it out!

Share This Page