Simple Machines Community Forum

SMF Support => SMF 1.1.x Support => Topic started by: Bigguy on January 05, 2006, 12:22:07 PM

Title: Adding ad code to RC2
Post by: Bigguy on January 05, 2006, 12:22:07 PM
How would I ad this code so the ad shows on every page, like were would I put it in RC2 ???

Quote<?php include('http://staff.x10hosting.com/adCode.php?ad=advanced'); ?>
Title: Re: Adding ad code to RC2
Post by: Oldiesmann on January 05, 2006, 12:28:50 PM
You would put that code (without the <?php and ?> tags) in index.template.php. However, the exact place where you would put that code depends on where you want it to appear.
Title: Re: Adding ad code to RC2
Post by: Bigguy on January 05, 2006, 12:34:02 PM
well either at the very top or the very bottom would be nice.
Title: Re: Adding ad code to RC2
Post by: Oldiesmann on January 05, 2006, 12:42:50 PM
Ok.

To put it at the very top (before anything else gets output):

Find
<body>';

And add it after that.

If it's not already centered and you want it to be centered:

Replace the above code with this:
<body><div align="center">';

Then put your ad code after that, and add a </div> right after the first echo '.

To add it at the very bottom:

Find
echo '
</div>
</body></html>';


Replace
echo '
</div>';
include('http://staff.x10hosting.com/adCode.php?ad=advanced');
echo '</body></html>';


Or (if you want to center it and it isn't already centered)
echo '
</div><div align="center">';
include('http://staff.x10hosting.com/adCode.php?ad=advanced');
echo '</div></body></html>';

Title: Re: Adding ad code to RC2
Post by: jerm on January 05, 2006, 12:47:40 PM
i will be releasing a mod in the next day or so that will do exactly what you want, so if you wish to wait, you can.
Title: Re: Adding ad code to RC2
Post by: Bigguy on January 05, 2006, 12:56:08 PM
Both ideas are great. If its ok I would like to post the changes that Oldiesmann has made to the support forum I work on for our members to use if they need it.

@ electrohome88: I might just wait for it myself but I do know of a couple ppl that might find this useful now.
Title: Re: Adding ad code to RC2
Post by: jerm on January 05, 2006, 01:00:51 PM
im sick as a dog, so im fixing it all up right now. so in like an hour it should be done, or less. just have to give me time to test it out, and assume theres no glitches
Title: Re: Adding ad code to RC2
Post by: Bigguy on January 05, 2006, 01:05:37 PM
Ok I will wait for you and test it out. I have a new smf 1.1 rc2 forum unmodded waiting for it.

@ Oldiesmann: is it ok to take your changes and put them on the hosting company I work for. Incase anyone needs the changes ?
Title: Re: Adding ad code to RC2
Post by: jerm on January 05, 2006, 01:32:59 PM
i have uploaded it and tested it on RC2 with the default theme.
http://mods.simplemachines.org/index.php?mod=255
Title: Re: Adding ad code to RC2
Post by: Bigguy on January 05, 2006, 01:34:29 PM
I cant download it. All I get is a white screen.
Title: Re: Adding ad code to RC2
Post by: jerm on January 05, 2006, 01:35:46 PM
donno why then
try this and upload it with the package manager
Title: Re: Adding ad code to RC2
Post by: Bigguy on January 05, 2006, 01:39:59 PM
ok got it that time. I`ll report about this in a minute.
Title: Re: Adding ad code to RC2
Post by: jerm on January 05, 2006, 01:41:07 PM
cool thanks, till im able to post images up in the mod section about this mod
go into features and settings, you will see an "ads" menu, click then, and the rest should explain itself
Title: Re: Adding ad code to RC2
Post by: Bigguy on January 05, 2006, 01:44:14 PM
It installed great but I cant seem to get the ad code I posted to work with or without the php tags. Code is in the first post, any ideas.
Title: Re: Adding ad code to RC2
Post by: jerm on January 05, 2006, 01:49:20 PM
thats the one thing i didn't test.. the includes
but what you can do is grab the code in the includes file and put that there instead

<script language='JavaScript' type='text/javascript'>
<!--
   if (!document.phpAds_used) document.phpAds_used = ',';
   phpAds_random = new String (Math.random()); phpAds_random = phpAds_random.substring(2,11);
   
   document.write ("<" + "script language='JavaScript' type='text/javascript' src='");
   document.write ("http://x10hosting.com/advert/adjs.php?n=" + phpAds_random);
   document.write ("&what=zone:3&target=_blank");
   document.write ("&exclude=" + document.phpAds_used);
   if (document.referrer)
      document.write ("&referer=" + escape(document.referrer));
   document.write ("'><" + "/script>");
//-->

</script><noscript><a href='http://x10hosting.com/advert/adclick.php?n=a915c788' target='_blank'><img src='http://x10hosting.com/advert/adview.php?what=zone:3&n=a915c788' border='0' alt='' /></a></noscript>


stick that in there
Title: Re: Adding ad code to RC2
Post by: Bigguy on January 05, 2006, 01:52:12 PM
ok thats got it. It shows up good. Only theres 2 of them now.

http://ang.x10hosting.com/forum/index.php
Title: Re: Adding ad code to RC2
Post by: jerm on January 05, 2006, 01:55:09 PM
lol ya, thats one thing i should add to the read me or the help or something

you have everything checked
to have it displayed on all the pages, just check index

to have it display just on the specific pages like board index, thread index, thread, have those checked. theeres no need to have all 4 of them checked

i put that there cause in googles TOS, you can't have it display ads on all the pages. so ya
Title: Re: Adding ad code to RC2
Post by: Bigguy on January 05, 2006, 01:59:54 PM
Ok its an awesome mod and it works good. Now I know this is not your problem and I will try to get this solved. Let me try to explain. On the hosting company I work for they have made a script that automatically checks accounts for ad codes. I wonder if the script we use would pick up on this. Would you have any ideas ??
Title: Re: Adding ad code to RC2
Post by: jerm on January 05, 2006, 02:04:13 PM
glad it worked, your my first official tester lol

and im guessing your hosting company doesn't want you to put ads up?.. i wouldn't know how to make it so that its not noticed. you can try first by not using "key words" such as ads or ad or adverts. thats probably how the script works. that is, if im understanding your question
Title: Re: Adding ad code to RC2
Post by: Bigguy on January 05, 2006, 02:07:22 PM
Oh yes it is in the T.O.S. that all accounts on the server other than the ones on the static plan have to have ads showing on all pages (ads from x10) You are also allowed to have your own ads but they can be no bigger than the one we place. The script I am talking about checks all accounts on the free server for the ad code if it does not show that account gets put in a list for suspension.
Title: Re: Adding ad code to RC2
Post by: jerm on January 05, 2006, 02:14:18 PM
oh, so your just asking if the script will pick up the fact you have their ads on your page
and in which case it will
Title: Re: Adding ad code to RC2
Post by: Bigguy on January 05, 2006, 02:17:00 PM
ok, I will also get this tested at our site to make sure this script of ours can pick up on it, Thank you sir for all your help. it has been most enlightening. Glad I could help test it for you.
Title: Re: Adding ad code to RC2
Post by: Bigguy on January 05, 2006, 02:20:04 PM
Would this code work the same way as the other ???

Quote<?php include('http://staff.x10hosting.com/adCode.php?ad=corporate'); ?>
Title: Re: Adding ad code to RC2
Post by: jerm on January 05, 2006, 02:23:13 PM
ya, you should be able to grab the source code of that file,
and just stick it under or on top of the ads that are already there. or work with some html codes and make it beside.. however you want
Title: Re: Adding ad code to RC2
Post by: Bigguy on January 05, 2006, 02:26:44 PM
If I took the bit of script you wrote for the other ad and changed the line in it to reflect this line it should work in your mod right. (Hope that was clear,lol)
Title: Re: Adding ad code to RC2
Post by: jerm on January 05, 2006, 02:28:38 PM
ya, not really sure what your asking

you can just play around with the code and see what you get. wont cause harm towards you. you can always hit the back button if it screws up the webpage
Title: Re: Adding ad code to RC2
Post by: Bigguy on January 05, 2006, 02:32:23 PM
You posted this script for the first line of code O presented:

Quote<script language='JavaScript' type='text/javascript'>
<!--
   if (!document.phpAds_used) document.phpAds_used = ',';
   phpAds_random = new String (Math.random()); phpAds_random = phpAds_random.substring(2,11);
   
   document.write ("<" + "script language='JavaScript' type='text/javascript' src='");
   document.write ("http://x10hosting.com/advert/adjs.php?n=" + phpAds_random);
   document.write ("&what=zone:3&target=_blank");
   document.write ("&exclude=" + document.phpAds_used);
   if (document.referrer)
      document.write ("&referer=" + escape(document.referrer));
   document.write ("'><" + "/script>");
//-->

</script><noscript><a href='http://x10hosting.com/advert/adclick.php?n=a915c788' target='_blank'><img src='http://x10hosting.com/advert/adview.php?what=zone:3&n=a915c788' border='0' alt='' /></a></noscript>

How would I put this in it:

Quote<?php include('http://staff.x10hosting.com/adCode.php?ad=corporate'); ?>

I guess its not to hard to figure once I look at it. (Yes, I`m still learning)  Thanks for all your help.

Title: Re: Adding ad code to RC2
Post by: jerm on January 05, 2006, 02:35:49 PM
ah okay, sorry. thought you knew a bit of html. its okay

try this out:

<script language='JavaScript' type='text/javascript'>
<!--
   if (!document.phpAds_used) document.phpAds_used = ',';
   phpAds_random = new String (Math.random()); phpAds_random = phpAds_random.substring(2,11);
   
   document.write ("<" + "script language='JavaScript' type='text/javascript' src='");
   document.write ("http://x10hosting.com/advert/adjs.php?n=" + phpAds_random);
   document.write ("&what=zone:3&target=_blank");
   document.write ("&exclude=" + document.phpAds_used);
   if (document.referrer)
      document.write ("&referer=" + escape(document.referrer));
   document.write ("'><" + "/script>");
//-->
</script>
<br />
<noscript><a href='http://x10hosting.com/advert/adclick.php?n=a915c788' target='_blank'><img src='http://x10hosting.com/advert/adview.php?what=zone:3&n=a915c788' border='0' alt='' /></a></noscript>

<script language='JavaScript' type='text/javascript'>
<!--
   if (!document.phpAds_used) document.phpAds_used = ',';
   phpAds_random = new String (Math.random()); phpAds_random = phpAds_random.substring(2,11);
   
   document.write ("<" + "script language='JavaScript' type='text/javascript' src='");
   document.write ("http://x10hosting.com/advert/adjs.php?n=" + phpAds_random);
   document.write ("&what=zone:1&target=_blank");
   document.write ("&exclude=" + document.phpAds_used);
   if (document.referrer)
      document.write ("&referer=" + escape(document.referrer));
   document.write ("'><" + "/script>");
//-->

</script><noscript><a href='http://x10hosting.com/advert/adclick.php?n=a7fb3e9d' target='_blank'><img src='http://x10hosting.com/advert/adview.php?what=zone:1&amp;n=a7fb3e9d' border='0' alt=''></a></noscript>


that will put your ads one on top of each other
ops, i mean side by side
i updated it for you.. now its one on top of each other
Title: Re: Adding ad code to RC2
Post by: Bigguy on January 05, 2006, 02:39:25 PM
Well I know a bit of html, thanks to all the websites and that I screw with. The 2 codes I posted are for seperate "Plans" on x10. the first goes to one ad and the second goes to another so in both instances each code should show up by itself, not together. But that code will work to for ppl who want both to show I guess.

EDIT: have to run out for a quick sec, brb.
Title: Re: Adding ad code to RC2
Post by: Bigguy on January 05, 2006, 04:05:32 PM
Thank you very much for this, its great. If I have any problems I will post back here. Your mod is just what I needed.
Title: Re: Adding ad code to RC2
Post by: Bigguy on January 12, 2006, 01:24:04 AM
This code breaks the forum. The ad shows up and the top half of the forum but thats it.

Quote from: electrohome88 on January 05, 2006, 02:35:49 PM
ah okay, sorry. thought you knew a bit of html. its okay

try this out:

<script language='JavaScript' type='text/javascript'>
<!--
   if (!document.phpAds_used) document.phpAds_used = ',';
   phpAds_random = new String (Math.random()); phpAds_random = phpAds_random.substring(2,11);
   
   document.write ("<" + "script language='JavaScript' type='text/javascript' src='");
   document.write ("http://x10hosting.com/advert/adjs.php?n=" + phpAds_random);
   document.write ("&what=zone:3&target=_blank");
   document.write ("&exclude=" + document.phpAds_used);
   if (document.referrer)
      document.write ("&referer=" + escape(document.referrer));
   document.write ("'><" + "/script>");
//-->
</script>
<br />
<noscript><a href='http://x10hosting.com/advert/adclick.php?n=a915c788' target='_blank'><img src='http://x10hosting.com/advert/adview.php?what=zone:3&n=a915c788' border='0' alt='' /></a></noscript>

<script language='JavaScript' type='text/javascript'>
<!--
   if (!document.phpAds_used) document.phpAds_used = ',';
   phpAds_random = new String (Math.random()); phpAds_random = phpAds_random.substring(2,11);
   
   document.write ("<" + "script language='JavaScript' type='text/javascript' src='");
   document.write ("http://x10hosting.com/advert/adjs.php?n=" + phpAds_random);
   document.write ("&what=zone:1&target=_blank");
   document.write ("&exclude=" + document.phpAds_used);
   if (document.referrer)
      document.write ("&referer=" + escape(document.referrer));
   document.write ("'><" + "/script>");
//-->

</script><noscript><a href='http://x10hosting.com/advert/adclick.php?n=a7fb3e9d' target='_blank'><img src='http://x10hosting.com/advert/adview.php?what=zone:1&amp;n=a7fb3e9d' border='0' alt=''></a></noscript>


that will put your ads one on top of each other
ops, i mean side by side
i updated it for you.. now its one on top of each other