X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   Hide if logged or not logged in (https://forum.x-cart.com/showthread.php?t=9684)

cotc2001 10-04-2004 01:39 AM

Hide if logged or not logged in
 
Ok it's my turn to answer a question today :D

im trying to hide or show certain tabs depending on if the user is logged in or not logged in.

for example I have 4 tabs in the template "LOGIN / REGISTER, YOUR ACCOUNT, RECOVER PASSWORD & ORDER HISTORY"

if not logged in only "LOGIN / REGISTER" & " RECOVER PASSWORD" should be shown if LOGGED IN only "YOUR ACCOUNT" & "ORDER HISTORY" should be shown.

i've managed to hide the tabs I want to hide when logged in but I cant work out how to hide the tabs when NOT logged in

this is the code i've got so far

Code:

<table  class"HeadLine" border="0" cellspacing="0" cellpadding="0">
    <tr>
        {if $login eq ""}
      <td>[img]{$ImagesDir}/accountnavlcorner.gif[/img]</td>
      <td bgcolor="#000000"><span class="TopBannerItems">{$lng.lbl_your_profile}</span></td>
      <td>[img]{$ImagesDir}/accountnavrcorner.gif[/img]</td>
      <td>[img]{$ImagesDir}/spacer.gif[/img]</td>
         
      <td>[img]{$ImagesDir}/accountnavlcorner.gif[/img]</td>
      <td bgcolor="#000000"><span class="TopBannerItems">{$lng.lbl_recover_password}</span></td>
      <td>[img]{$ImagesDir}/accountnavrcorner.gif[/img]</td>
      <td>[img]{$ImagesDir}/spacer.gif[/img]</td>
      {/if}
          {if $usertype eq "C"}
                    <td>[img]{$ImagesDir}/accountnavlcorner.gif[/img]</td>
      <td bgcolor="#000000"><span class="TopBannerItems">{$lng.lbl_orders_history}</span></td>
      <td>[img]{$ImagesDir}/accountnavrcorner.gif[/img]</td>
      <td>[img]{$ImagesDir}/spacer.gif[/img]</td>
          {/if}
          <td></td>
    </tr>
  </table>


i know it's something simple i've missed but the question is what???

Cheers for any help

THIS IS FOR VERSION 4.0.3

shan 10-04-2004 03:43 AM

you probably want to use

{if $login ne ""}

eq - equals
ne - not equals

see http://smarty.php.net for all this and more

cotc2001 10-04-2004 05:24 AM

Bingo!!!

Cheers Shan, on another note how is your diary fixed for some mods i need doing.

i'll email you the full specs of what im trying to do.

TL408 06-06-2008 06:49 AM

Re: Hide if logged or not logged in
 
Hi COTC2001,

Do you know if your code below would work on the 4.1.9 version?

Thanks!


Quote:

Originally Posted by cotc2001
Ok it's my turn to answer a question today :D

im trying to hide or show certain tabs depending on if the user is logged in or not logged in.

for example I have 4 tabs in the template "LOGIN / REGISTER, YOUR ACCOUNT, RECOVER PASSWORD & ORDER HISTORY"

if not logged in only "LOGIN / REGISTER" & " RECOVER PASSWORD" should be shown if LOGGED IN only "YOUR ACCOUNT" & "ORDER HISTORY" should be shown.

i've managed to hide the tabs I want to hide when logged in but I cant work out how to hide the tabs when NOT logged in

this is the code i've got so far

Code:

<table  class"HeadLine" border="0" cellspacing="0" cellpadding="0">
    <tr>
        {if $login eq ""}
      <td>[img]{$ImagesDir}/accountnavlcorner.gif[/img]</td>
      <td bgcolor="#000000"><span class="TopBannerItems">{$lng.lbl_your_profile}</span></td>
      <td>[img]{$ImagesDir}/accountnavrcorner.gif[/img]</td>
      <td>[img]{$ImagesDir}/spacer.gif[/img]</td>
         
      <td>[img]{$ImagesDir}/accountnavlcorner.gif[/img]</td>
      <td bgcolor="#000000"><span class="TopBannerItems">{$lng.lbl_recover_password}</span></td>
      <td>[img]{$ImagesDir}/accountnavrcorner.gif[/img]</td>
      <td>[img]{$ImagesDir}/spacer.gif[/img]</td>
      {/if}
          {if $usertype eq "C"}
                    <td>[img]{$ImagesDir}/accountnavlcorner.gif[/img]</td>
      <td bgcolor="#000000"><span class="TopBannerItems">{$lng.lbl_orders_history}</span></td>
      <td>[img]{$ImagesDir}/accountnavrcorner.gif[/img]</td>
      <td>[img]{$ImagesDir}/spacer.gif[/img]</td>
          {/if}
          <td></td>
    </tr>
  </table>


i know it's something simple i've missed but the question is what???

Cheers for any help

THIS IS FOR VERSION 4.0.3


cotc2001 06-06-2008 11:40 PM

Re: Hide if logged or not logged in
 
Cant tell for certain but it should do


All times are GMT -8. The time now is 01:26 AM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.