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

When typing a new message, where is the "title" code/tag?

Discussion in 'XenForo Development Discussions' started by Trained Monkey, Feb 14, 2014.

  1. I've changed the title position on my forum and it works well... apart from when typing a new message, the "title" preview breaks and is in the wrong place.

    You can see how I've moved the title by looking on the forum here: http://oxleywoodsliving.co.uk/forum

    I'd like to control where the "title preview" appears, but not sure how/where that's injected in to the HTML. Can anyone help.

    Image attached to show the text I'm taking about...

    titlebit.png
     
  2. lazy llama

    lazy llama Well-Known Member

    It looks like it's this part of the thread_create template:
    Code:
                <dd><input type="text" name="title" class="textCtrl titleCtrl" id="ctrl_title_thread_create" maxlength="100" autofocus="true"
                    placeholder="{xen:phrase thread_title}..." value="{$title}"
                    data-liveTitleTemplate="{xen:phrase create_thread}: <em>%s</em>" /></dd>
    
    The data-liveTitleTemplate controls the 'live' part of that form.
     
    Trained Monkey likes this.
  3. Ah-ha. Will have a play. No idea how I missed that. Well, two minds and all that... :)
     
  4. Wait, hold on. That's where I enter the text, but what about where it's appearing above, that's what I want to control. At the moment that's appearing in a quite random position in my header. Any ideas?
     
  5. lazy llama

    lazy llama Well-Known Member

    Ah that's where it gets trickier :)

    There's a Javascript function called XenForo.LiveTitle in js/xenforo/full/xenforo.js which rewrites the <h1> tag with the title as you type it.
    But what <h1> tag? That comes from the page_container_content_title_bar template.
    Now how you move that without breaking every other page, I'll leave as an exercise for you...

    (which means I have no idea).
     
    Trained Monkey likes this.
  6. OK, it's quite easy. Give your "target" header a class, and change (b=c("h1").first()); to this (b=c("h1.newclass").first());

    Seems to work fine so far.

    Screen Shot 2014-02-14 at 14.28.45.png
     
    lazy llama likes this.

Share This Page