Jump to content

IF ELSE


Recommended Posts

I'm creating a nav bar that will show one thing if the user isn't logged in and another if the user is logged in. I have created it successfully but I don't believe its working like it should although it seems like it does...This code is from the phpbb 3.0 forum that I have been altering.

 

The code is this

 

   

<!-- IF not S_USER_LOGGED_IN and not S_IS_BOT -->
          <div class="navbar">
            <div class="inner"><span class="corners-top"><span></span></span>
                 <ul class="linklist navlinks">
                    <li class="forum-home"><a href="{U_INDEX}" title="{L_INDEX}">Forum Home</a></li>
                <li <fieldset class="icon-faq"><a href="{U_FAQ}" title="{L_FAQ_EXPLAIN}">{L_FAQ}</a></fieldset></li>
                <li><form method="post" action="{S_LOGIN_ACTION}" class="headerspace">
                <!-- IF S_REGISTER_ENABLED --><a href="{U_REGISTER}">{L_REGISTER_HOME}</a><!-- ENDIF -->
                <li><fieldset class="quick-login">
             <label for="username">{L_USERNAME}:</label><input type="text" name="username" id="username" size="10" class="inputbox" title="{L_USERNAME}" /><!-- IF S_AUTOLOGIN_ENABLED --><label for="autologin">{L_LOG_ME_IN} <input type="checkbox" name="autologin" id="autologin" /></label></li>
             <!-- ENDIF --> 
             <li><fieldset class="quick-login1">
                <label for="password">{L_PASSWORD}:</label><input type="password" name="password" id="password" size="10" class="inputbox" title="{L_PASSWORD}" /></br>
                <input type="submit" name="login" value="{L_LOGIN}" class="button2" />
             </fieldset></li>
             <!-- IF S_DISPLAY_SEARCH and not S_IN_SEARCH -->
                <li><div id="search-box" style="cursor: pointer;">
                </fieldset>
                <form action="{U_SEARCH}" method="post" id="search">
                  <fieldset>
                    <input name="keywords" id="keywords" type="text" maxlength="128" title="{L_SEARCH_KEYWORDS}" class="inputbox search" value="<!-- IF SEARCH_WORDS-->{SEARCH_WORDS}<!-- ELSE -->{L_SEARCH_MINI}<!-- ENDIF -->" onclick="if(this.value=='{LA_SEARCH_MINI}')this.value='';" onblur="if(this.value=='')this.value='{LA_SEARCH_MINI}';" />
                    <input class="button2" value="{L_SEARCH}" type="submit" /><br />
                    <a href="{U_SEARCH}" title="{L_SEARCH_ADV_EXPLAIN}">{L_SEARCH_ADV}</a> {S_SEARCH_HIDDEN_FIELDS}
                  
             <!-- ENDIF -->
                </fieldset>
               </form>
                <li class="icon-home"><a href="{U_INDEX}" accesskey="h">{L_INDEX}</a> <!-- BEGIN navlinks --> <strong>&#8249;</strong> <a href="{navlinks.U_VIEW_FORUM}">{navlinks.FORUM_NAME}</a><!-- END navlinks --></li>

                
             </ul>
               
                <!-- ELSE IF S_USER_LOGGED_IN and S_IS_BOT -->
          <div class="navbar">
            <div class="inner"><span class="corners-top"><span></span></span>
                 <ul class="linklist1 navlinks1">
                    <li class="forum-home"><a href="{U_INDEX}" title="{L_INDEX}">Forum Home</a></li>
                    <!-- IF not S_IS_BOT and S_USER_LOGGED_IN -->
                <li class="icon-ucp">
                   <a href="{U_PROFILE}" title="{L_PROFILE}" accesskey="u">{L_PROFILE}</a>
                </li>
                <li <fieldset class="icon-faq"><a href="{U_FAQ}" title="{L_FAQ_EXPLAIN}">{L_FAQ}</a></fieldset></li>
                <li class="icon-logout"><a href="{U_LOGIN_LOGOUT}" title="{L_LOGIN_LOGOUT}" accesskey="l">{L_LOGIN_LOGOUT}</a></li> 
             <!-- IF S_DISPLAY_SEARCH and not S_IN_SEARCH -->
                <li><div id="search-box" style="cursor: pointer;">
                </fieldset>
                <form action="{U_SEARCH}" method="post" id="search">
                  <fieldset>
                    <input name="keywords" id="keywords" type="text" maxlength="128" title="{L_SEARCH_KEYWORDS}" class="inputbox search" value="<!-- IF SEARCH_WORDS-->{SEARCH_WORDS}<!-- ELSE -->{L_SEARCH_MINI}<!-- ENDIF -->" onclick="if(this.value=='{LA_SEARCH_MINI}')this.value='';" onblur="if(this.value=='')this.value='{LA_SEARCH_MINI}';" />
                    <input class="button2" value="{L_SEARCH}" type="submit" /><br />
                    <a href="{U_SEARCH}" title="{L_SEARCH_ADV_EXPLAIN}">{L_SEARCH_ADV}</a> {S_SEARCH_HIDDEN_FIELDS}
                  
             <!-- ENDIF -->
                <!-- ENDIF -->
                <!-- ENDIF -->

 

 

 

Could someone tell me if this is correct? It works properly cause if you logged in it shows the other nav but anything after the ELSE i can change and it doesn't matter it still shows the nav after log in.

 

What I'm ultimately looking to accomplish is add another else so the first else looks to see if the user is logged in and is not a moderator and shows that nav and then and else that looks to see if the user is logged in and is a moderator and shows a different nav.

 

I would appreciate any help and sorry if I posted in the wrong place.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.