Announcement

Collapse
No announcement yet.

phpinclude_start and conditions?

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

  • phpinclude_start and conditions?

    Hey,

    I posted this over at vbulletin.org too, but I really need a quick response to this. I hope someone can help me. The following is part of my phpinclude_start;

    PHP Code:
    $page_menu '<if condition="$show['registerbutton']">
                    <li><a href="">register</a></li>
                    </if>'

    Then I place the $page_menu script into my header template. Without the if statement, this works fine, and the register link is displayed. But, when I place the if statement in there, it refuses to display the link, and it's nowhere to be seen in the source code either.

    It's mandatory that this be in the phpinclude_start, and nowhere else. The reason for this is because I'm using case statements to display different links on different pages.

    So my question is, how do I get conditions to work in the phpinclude_start?

    Please note, stripping the slashes doesn't work, I've already tried. Thanks in advance.

  • #2
    Why not just put it in the navbar and take out the $page_menu part....

    It'd work the same

    I'd guess its not working because you are using improper syntax

    Comment


    • #3
      Why not just put it in the navbar and take out the $page_menu part....

      It'd work the same
      With all respect this is not true, templates don't allow you use to use <?php ?> in them. So how would achieve the desired effect using case statements within XHTML markup?

      I'd guess its not working because you are using improper syntax
      Could you correct the syntax please? I don't know PHP very well, but I'm lead to believe the syntax is correct due to when removing the if statement, the register link works.

      I would just like a little insight in to how to use if statements/conditions within the phpinclude_start bit. It can't be that difficult surely for someone familiar with PHP and vB?

      Comment


      • #4
        why not just use
        <if condition="$show['registerbutton']"><li><a href="">register</a></li></if>

        Instead of $page_menu ?

        Comment


        • #5
          Because I'm using a case script, so if they're on say index.php then I want it to show, wheras if they're on the forumdisplay.php page, it wouldn't.

          This isn't precisely my use for it, the above is quite pointless, but basically that's how it would work, if it was setup like that.

          Code:
          switch (THIS_SCRIPT)
          	{
          		  case 'index':
          			  $page_menu = '
          			<ul>
          		 	<li><a href="">forum home</a></li>
          				<if condition="$show['registerbutton']">
          		 	<li><a href="">register</a></li>
          				</if>
          		 	<li><a href="">usergroups</a></li>
          			</ul>
          			  ';
          			   break; 
          		 
          		   case 'home_page':
          			 $page_menu = 'this works on the home_page script page.';
          			   break; 
          	}
          It just won't display if I put the if condition in there.

          Comment


          • #6
            No one?

            Comment


            • #7
              Interesting I am in need of the same thing but for the php end.

              I have a piece of code that calls a php script that I want to load AFTER the index template page has completely loaded and only on the index page.

              I would also be intrested in this idea.

              Comment


              • #8
                And you can't just modify the main FORUMHOME, FORUMDISPLAY, etc. templates to do what you want?

                A switch/case statement is nice, but if you can get away with doing vBulletin Conditional IF's, your life will be a lot easier! You can even do ELSE within vB Conditionals.

                Comment

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