help to edit css / html

Started by desai_amogh, April 09, 2014, 10:16:36 AM

Previous topic - Next topic

desai_amogh

check this site: http://www.electronicsforum.in/index.php

you will see a guest login bar.. yellow .. right at the top and a Ad below...

but after you login.. the bar goes away and a ugly space remains .. as i use this html for the Ad:
<div align="center" style="margin-bottom: 5px; margin-top: 35px;"> ---Ad Code Here -- </div>

can I make this conditional somehow ??

that if guest margin-top: 35px

if not margin-top: 5px


can we code it like that ????


Dzonny

Sure you can...
Use this code:

';
if ($context['user']['is_logged']) {
echo'<div align="center" style="margin-bottom: 5px; margin-top: 5px;"> ---Ad Code Here -- </div>';
}
else
echo'<div align="center" style="margin-bottom: 5px; margin-top: 35px;"> ---Ad Code Here -- </div>';

That should do the trick.

desai_amogh

#2
Thanks @Dzonny

I tried your code..im using the Ad Management mod .. and if I paste your code.. nothing happens .. moreover, some of the code shows  at left top corner behind the yellow bar..  something is not write.. may be the way that code is processed..

Can I do something to this effect :


<div align="center" style="margin-bottom: 5px; <?php if ($context['user']['is_logged']) {echo 'margin-top:5px;'} else {echo 'margin-top:35px;'?>">

-- Ad Code Here --


</div>


btw .. this ^ code doesnt work.. with this code the yellow bar just overlaps the ad ..


===================

Also, this below code works for guests, perfactly with the yellow bar on top.. but for logged in users it shows an ugly top-margin=35px

<div align="center" style="margin-bottom: 5px; margin-top:35px;">

-- google ad script --

</div>

Dzonny

Is the type of your add set to "php" instead of "html"?
If not please set it to php and try the code I provided again.

desai_amogh

nope..i changed it to PHP and its  not working ....i get the following error when lgged in:


Parse error: syntax error, unexpected T_STRING in /home/xxxxx/SMFhome/Sources/Load.php(2158) : eval()'d code(651) : eval()'d code on line 2

and guests dont see the ads, between yellow bar and boddy.



Dzonny

Okay, let's try this one, put it in php type ad:

global $context;
if ($context['user']['is_logged']) {
echo'<div align="center" style="margin-bottom:5px; margin-top: 5px;"> ---Ad Code Here 1-- </div>';
}
else
{
echo'<div align="center" style="margin-bottom: 5px; margin-top: 35px;"> ---Ad Code Here else-- </div>';
}

Just tried it with ad management mod, and it's working fine on my test forum...

desai_amogh

Perfact !!

you are a genious !

Advertisement: