News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

HTML code only for visitors

Started by PLAYBOY, September 22, 2018, 08:04:13 PM

Previous topic - Next topic

PLAYBOY

Adsense has a new feature called Auto ads which is awesome. You add only one small script to any page you want an ad on, it takes care of the rest. The sizes, places, timing etc. I really like it so far.

But I want to show ads only to the visitors (not logged in) in pretty much every page.

So is there a file where I can just ad a script within HEAD tags and that script will be visible only to the visitors (not logged in) ?

vbgamer45

index.template.php

put in php code for $user_info['is_guest']
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

PLAYBOY

Thank you for your help.

I don`t have $user_info['is_guest'] in my template index.template.php (Attached)

Also the script I need to add has to be within HEAD tags and I don`t see the HEAD in this file either

Mick.

Replace "Google code goes in here" with the google code...


// If the user is guest, feed them all these mumble-jumble google ads
if ($context['user']['is_guest'])
{
echo'
                                              Google code goes in here';
                                }

PLAYBOY

Quote from: Mick. on September 22, 2018, 08:27:51 PM
Replace "Google code goes in here" with the google code...


// If the user is guest, feed them all these mumble-jumble google ads
if ($context['user']['is_guest'])
{
echo'
                                              Google code goes in here';
                                }


In which file I should put this code in? and where exactly?

vbgamer45

Put it before

// Please don't index these Mr Robot.


in index.template.php
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

PLAYBOY


Advertisement: