Hide ad banners from users logged in

Started by aw06, October 02, 2009, 08:36:37 AM

Previous topic - Next topic

aw06

I have some add banners on my site .. similar to the 468 x 60 ad banner at the top of this site .. thing is, i want to display 2 Banners .. guest will see both and users logged in will only see one ...

I call my advert.php file into index.template using echo

Quote////////////////////////////////////////////////////////////////////////////////////////////////////////////////
   //echo
   include 'advert.php';
   echo '<BR>';
   ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
   // Show the news fader?  (assuming there are things to show...)

What i want is something like this

Quote////////////////////////////////////////////////////////////////////////////////////////////////////////////////
   //echo
   include 'advert.php';
   echo '<BR>';
   include 'advert2.php';
   ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
   // Show the news fader?  (assuming there are things to show...)

Where only guest will see advert2 ...

Possible ??
:: ShopinJA.com Powered by SMF 1.1.19 | Ig-Oh Theme by Koni | 70 Rock Solid Error Free Mods | Many Custom Edits & Tweaks ::
- Host Unlimited Websites - Free Website Builder & Templates - Unlimited Disk Space & Bandwidth

Arantor

So does the first code work?

If so, you can make the second one visible only to guests with by adding this in front of it:
if($context['user']['is_guest'])

Meaning you end up with:
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
   //echo
   include 'advert.php';
   echo '<br />';
   if($context['user']['is_guest']
      include 'advert2.php';
   ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
   // Show the news fader?  (assuming there are things to show...)


Btw, it's easier to use code than quote tags where code is concerned.
Holder of controversial views, all of which my own.


aw06

#2
Yeah .. the codes work, the banners are displayed ... when i try what you suggested i get this error

Parse error: syntax error, unexpected T_INCLUDE

??
:: ShopinJA.com Powered by SMF 1.1.19 | Ig-Oh Theme by Koni | 70 Rock Solid Error Free Mods | Many Custom Edits & Tweaks ::
- Host Unlimited Websites - Free Website Builder & Templates - Unlimited Disk Space & Bandwidth

Arantor

Holder of controversial views, all of which my own.


aw06

Basically the line i put it on ...... line 783
:: ShopinJA.com Powered by SMF 1.1.19 | Ig-Oh Theme by Koni | 70 Rock Solid Error Free Mods | Many Custom Edits & Tweaks ::
- Host Unlimited Websites - Free Website Builder & Templates - Unlimited Disk Space & Bandwidth

aw06

sorry, any line below where i place the code you gave
:: ShopinJA.com Powered by SMF 1.1.19 | Ig-Oh Theme by Koni | 70 Rock Solid Error Free Mods | Many Custom Edits & Tweaks ::
- Host Unlimited Websites - Free Website Builder & Templates - Unlimited Disk Space & Bandwidth

Arantor

Holder of controversial views, all of which my own.


aw06

lol .. ok''' I'll try

if($context['user']['is_guest'])
:: ShopinJA.com Powered by SMF 1.1.19 | Ig-Oh Theme by Koni | 70 Rock Solid Error Free Mods | Many Custom Edits & Tweaks ::
- Host Unlimited Websites - Free Website Builder & Templates - Unlimited Disk Space & Bandwidth

Arantor

Holder of controversial views, all of which my own.


aw06

works ...  :D

Is there a context such as

if($context['user']['is_user'])

???
:: ShopinJA.com Powered by SMF 1.1.19 | Ig-Oh Theme by Koni | 70 Rock Solid Error Free Mods | Many Custom Edits & Tweaks ::
- Host Unlimited Websites - Free Website Builder & Templates - Unlimited Disk Space & Bandwidth

Arantor

if($context['user']['is_logged']) for that.
Holder of controversial views, all of which my own.


aw06

yeah, figured it out ... thanks ...

topic solved 8)
:: ShopinJA.com Powered by SMF 1.1.19 | Ig-Oh Theme by Koni | 70 Rock Solid Error Free Mods | Many Custom Edits & Tweaks ::
- Host Unlimited Websites - Free Website Builder & Templates - Unlimited Disk Space & Bandwidth

Advertisement: