Hi everyone, I am in need of some urgent help here. I have been working on some code that shows google ads to guests but only under the first post on my forum. I have this working but want to add CSS styling to it. I need the styling to be within the <?php ?> tags so it only shows for guests and only under the first post, if I put surrounding div tags it puts styling under every post and I dont want that. Here is the code so far <?php if ($pun_user['is_guest'] == '1' && $post_count == '1') echo ' <script type="text/javascript"><!-- google_ad_client = "ca-pub-6495445176343776"; /* After First Post */ google_ad_slot = "9383224376"; google_ad_width = 728; google_ad_height = 90; //--> </script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script>' ?> Code (markup): Help is appreciated
Basically all I'm after is where to place the div so the styling is only applied if the conditions are met and so it doesnt cause an error.
add a brackets your also missing your ending ";" after your echo. You also don't need to use <?php you can just use <?
Thanks Guys, sorted it out. <?php if ($pun_user['is_guest'] == '1' && $post_count == '1') echo ' <div style="clear:both; margin-bottom: 3px;"><div class="adblock1"><script type="text/javascript"><!-- google_ad_client = "ca-pub-6495445176343776"; /* After First Post */ google_ad_slot = "9383224376"; google_ad_width = 728; google_ad_height = 90; //--> </script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script></div></div>'; ?> Code (markup):