Announcement

Collapse
No announcement yet.

Show 1 template to guests, another to members

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Show 1 template to guests, another to members

    At the moment I have my homepage including $navbar as per the default setting. How would I be able to specify it to call up a different navbar template i.e. navbar2 if a guest was viewing the page and restrict this to one page or area of the site, in my case an extra page I've added with a wrapper to become the homepage.

    I don't want to do it with a conditional within the navbar file as it would make the change sitewide - if possible I want it so on the page wrapper where it says $navbar, I can somehow wrap some conditionals around it and then throw up the second navbar page. Would this be as simple as $navbar2 or would it have to be a bit more complicated?

    Would the following work

    Code:
     <if condition="$bbuserinfo['userid'] == 0">
    $navbar2
    <else />
    $navbar
    </if>
    or would it be advisable to use usergroups (if so, I'm not sure of the code on this)?

  • #2
    Support for customizations and help with custom source code falls outside of default vBulletin support. I am sorry but we can't help you.

    What you porbably need to do is edit the .php file and add a php if condition around the eval code.

    Comment


    • #3
      How I would do this:

      I would define THIS_SCRIPT inside your frontpage, and use the global navbar template that all vb pages use.

      I would call my frontpage: index.php,
      I would call my forum: forum.php

      In the navbar template:

      <if condition="THIS_SCRIPT == 'frontpage'">
      <!-- We are on the frontpage! -->
      <!-- Here I would match against userinfo, usergroupid for guest/member and show custom navbar code -->

      <else />
      <!-- We are not on the frontpage (and therefor on the forum) -->
      <!-- Here I put the normal navbar code -->

      </if>

      Comment


      • #4
        I do get where you're coming from but it seems like quite a complex solution to what would/should be achievable with an if conditional.

        If we shift the focus over to the FORUMHOME template (so strictly no source code changes and only a slight template modification). Would it be possible to wrap the $navbar bit with conditionals and moreso is calling up another template as simple as $navbar2 or is it more complex.

        If I'm way off the ball here, I'll be happy to have a go with your solution.

        Comment


        • #5
          It has to be evalled in the .php file.

          And I think what you require does not have to be done the way you try to do it.

          Comment


          • #6
            Thanks - I gave it a go and it worked great.

            Comment


            • #7
              Bumping my old thread. I know it's uncool but I figured better use the resource we've already got here on this one rather than starting up another.

              If in this code that was given...

              Code:
               <if condition="THIS_SCRIPT == 'frontpage'">
              ...I want to add another script i.e. showthread, how would I do this? A simple comma in between the two?

              Comment


              • #8
                Code:
                <if condition="(THIS_SCRIPT == 'frontpage') || (THIS_SCRIPT == 'showthread')">
                Translations provided by Google.

                Wayne Luke
                The Rabid Badger - a vBulletin Cloud demonstration site.
                vBulletin 5 API - Full / Mobile
                Vote for your favorite feature requests and the bugs you want to see fixed.

                Comment


                • #9
                  Originally posted by Wayne Luke View Post
                  Code:
                  <if condition="(THIS_SCRIPT == 'frontpage') || (THIS_SCRIPT == 'showthread')">


                  Your great helped me no end that did thanks.....

                  Comment

                  widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
                  Working...
                  X