Announcement

Collapse
No announcement yet.

Show prefix on page title module

Collapse
X
Collapse
First Prev Next Last
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Show prefix on page title module

    Hi,

    It's me again

    I'm trying to show the topic prefix in the page title module.
    I don't know if I'm using the correct terminology so I'll explain my goal.
    I use topic prefix, and I would like them to be shown on every page of the topic, currently vB 5 only show it in the first topic of the page.
    After the first page, if the topic prefix contains an important info, user don't see it.

    I think I've located the template in question, it should be the widget_pagetitle.
    I've looked at how the template display_contenttype_threadview_header is fetching the prefix info :

    Code:
    <h2 class="b-post__title js-post-title OLD__post-title">
          <vb:if condition="$conversation['iconpath']">
              <img src="{vb:var baseurl_core}/{vb:var conversation.iconpath}" width="16" height="16" alt="" />
          </vb:if>
          <vb:if condition="$conversation['prefixid']">
              {vb:set searchStr, '{"prefix":["'}
              {vb:strcat searchStr, {vb:var conversation.prefixid}, '"]}'}
              <a href="{vb:url 'search'}?searchJSON={vb:urlencode {vb:raw searchStr}}">{vb:raw conversation.prefix_rich}</a>
          </vb:if>
       {vb:raw conversation.title}
    </h2>
    I think I only need the last if statement (but not sure).

    I tried inserting it inside the widget_pagetitle, in that section :

    Code:
    <vb:if condition="$page['channelid'] != $nodeid AND !empty($conversationStarter) AND isset($conversationStarter['htmltitle']) AND !empty($conversationStarter['htmltitle'])">
        {vb:set pageTitle, {vb:raw conversationStarter.htmltitle}}
    <vb:elseif condition="$newContentPageTitle" />
        {vb:set pageTitle, {vb:raw newContentPageTitle}}
    <vb:else />
        {vb:set pageTitle, {vb:raw page.title}}
    </vb:if>
    Just after the
    Code:
    {vb:set pageTitle, {vb:raw conversationStarter.htmltitle}}
    But it's not showing, I'm wondering if I've forgotten something to be able to load it here, if someone has some guidance for that, it would be greatly appreciated

    Thanks a lot
    Cheers

    #2
    I've been playing and testing all day with that, and I can't figure out what I'm not doing correctly there. I'm sure I'm just missing a declaration or initizialition somewhere.
    I've tried going another route with using vb data to pull info out of the API but the call to output the prefix is way too obscure in the documentation.

    glennrocksvb Sorry to ping you on that, but if you have any guidance, I know you are not a fan of doing things like that in the template (it's a full-custom template, not the native one) but it's currently way easier for me to attempt it that way

    Comment


      #3
      Making some very, very slow progress, but pretty much always hitting the same wall.

      I've resorted to using Javascript to fetch the prefix Id from the first post and "paste" it in the page title, this works really well and allow me to bring the attention to the user with some Javascript loading animation.

      But obviously, if a user end up in the second page of a thread without loading the first page, the script is unable to find the prefix, since the prefix and thread title are only present in the first post of a thread.

      I've managed to get the title to show in each replies by using the correct vb variable for replies, which is :

      Code:
      {vb:raw conversation.startertitle}
      But I'm still unable to get the prefix to show in the replies.

      My focus is on this template : display_contenttype_conversationreply_Text which is where I was able to find the correct vb variable for the title in replies.
      But no luck getting anywhere with the prefix.

      I looked at getting the prefix with the API and the {vb:data} but I don't see any way of getting thread info (or conversation info as they are called) via the API.

      I'm guessing glennrocksvb you faced similar problems when making your first post repeat plugin, and I can understand you don't want to share a solution that would diminish the value of your hard work on that plugin, but I'm just looking at a way of getting that damn prefix and I'm running out of idea !

      By the way, I post here instead on vb.org because I'm not the owner of the licensed account for my Vbulletin, I'm just one of the tech guys working on it

      Cheers all and thanks for reading

      Comment


        #4
        You were on the right track in your solution in the first post. But use this code instead
        Code:
        <vb:if condition="!empty($conversation)">
                {vb:set conversationPrefix, {vb:raw conversation.$nodeid}}
                <vb:if condition="$conversationPrefix['prefixid']">
                    {vb:set searchStr, '{"prefix":["'}
                    {vb:strcat searchStr, {vb:var conversationPrefix.prefixid}, '"]}'}
                    {vb:set prefix, '<a href="'}
                    {vb:strcat prefix, {vb:url 'search'}, '?searchJSON=', {vb:urlencode {vb:raw searchStr}}, '">', {vb:raw conversationPrefix.prefix_rich}, '</a>'}
                    {vb:set pageTitleTemp, {vb:raw pageTitle}}
                    {vb:set pageTitle, {vb:raw prefix}}
                    {vb:strcat pageTitle, ' ', {vb:raw pageTitleTemp}}
                </vb:if>
        </vb:if>
        Helpful? Donate. Thanks!
        Buy me a coffeePayPal QR Code
        Fast VPS Host for vBulletin:
        A2 Hosting & IONOS

        Comment


          #5
          Thank you very, very much Glenn !
          This indeed worked like a breeze !

          Comment


          • glennrocksvb
            glennrocksvb commented
            Editing a comment
            You're welcome. Glad to help!

            I might start a new post for this as a free modification to help others.

          #6
          Not wanting a ready-made solution, but just as a side note and some info on feasibility.
          There's currently no functioning way of assigning a prefix by default to a forum (or at all for that matter).
          The stupid way of vbulletin that only allows licenced users to see the bug tracker doesn't allow me to see if there's a fix for that, but there is a thread that mention that it's a known bug regarding the feature called : Required prefix

          Do you think it would be hard to do have a default prefix for a specific forum ? Of course a proper mod would be best, but I'm not against some core modifications for that whether it be in templates or other methods.

          And glennrocksvb would be nice to see the prefix on each page as a free modification, my code is messy and has other tweaks in it, so not worth posting it (I've duplicated the page title widget and added your code alongside other things)

          Comment


            #7
            I have an existing Require Topic Prefixex mod at https://vbmods.rocks/forum/vbulletin...topic-prefixes

            Helpful? Donate. Thanks!
            Buy me a coffeePayPal QR Code
            Fast VPS Host for vBulletin:
            A2 Hosting & IONOS

            Comment


            • Glaudiar
              Glaudiar commented
              Editing a comment
              Thanks, posted a question over there !

          Users Viewing This Page

          Collapse

          There is 1 user viewing this forum topic.

          • Guest Guest

          Latest Posts

          Collapse

          Working...
          X
          Searching...Please wait.
          An unexpected error was returned: 'Your submission could not be processed because you have logged in since the previous page was loaded.

          Please push the back button and reload the previous window.'
          An unexpected error was returned: 'Your submission could not be processed because the token has expired.

          Please push the back button and reload the previous window.'
          An internal error has occurred and the module cannot be displayed.
          There are no results that meet this criteria.
          Search Result for "|||"