Simple Machines Community Forum

Customizing SMF => SMF Coding Discussion => Topic started by: JeF4y on September 13, 2004, 08:49:43 AM

Title: Where to insert Banner invocation code
Post by: JeF4y on September 13, 2004, 08:49:43 AM
Hoping someone can help.

I'm a YaBBSE kinda guy and am running another forum using the new SMF (beta5).  I run PHPadsNEW for banners, and need to know where to insert the invocation code.

Unfortunately I'm not incredibly PHP savvy, so I don't really know where to put the code to make it appear properly. 

My forum is at:  http://www.cbr1000rr.net/forum/index.php

Ideally the banners would be centered below the buttons (home/help/search/etc...).

Any help would be greatly appreciated.

TIA

-Jeff
Title: Re: Where to insert Banner invocation code
Post by: Vinoth on September 13, 2004, 08:58:18 AM
do u use PHP code, or Javascript generated code,

u can check in my forum, http://www.webhoststalk.com/forum

just tell me, i will help u
Title: Re: Where to insert Banner invocation code
Post by: JeF4y on September 13, 2004, 11:21:40 AM
"remote invocation for javascript"

Here's the code that needs to go in I just don't know where to put it...


<center>
<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://www.cbr1000rr.net/phpAdsNew-2.0/adjs.php?n=" + phpAds_random);
   document.write ("&amp;what=zone:1");
   document.write ("&amp;exclude=" + document.phpAds_used);
   if (document.referer)
      document.write ("&amp;referer=" + escape(document.referer));
   document.write ("'><" + "/script>");
//-->
</script><noscript><a href='http://www.cbr1000rr.net/phpAdsNew-2.0/adclick.php?n=aa4398ed' target='_blank'><img src='http://www.cbr1000rr.net/phpAdsNew-2.0/adview.php?what=zone:1&amp;n=aa4398ed' border='0' alt=''></a></noscript>
</center>
Title: Re: Where to insert Banner invocation code
Post by: Jay? on September 13, 2004, 01:51:47 PM
If you have not finished this up yet.  Let me know - I'll PM you my header that has the AD's installed.

Title: Re: Where to insert Banner invocation code
Post by: JeF4y on September 13, 2004, 02:15:31 PM
Nope, I haven't finished it.  I'm still waiting for a pointer as to where to put it... (yes, I know how bad that sounds  :P  8) )
Title: Re: Where to insert Banner invocation code
Post by: Jay? on September 13, 2004, 02:49:36 PM
I have added the index.template.php file on this post.  The main portion of code you are interested in is between lines 157 and 160.

Anyway - you can see this in action at smfhacks.com/forum

Cannot add the file :|

You can download it here: http://www.smfhacks.com/files/pafiledb.php?action=file&id=5


Title: Re: Where to insert Banner invocation code
Post by: JeF4y on September 13, 2004, 02:59:58 PM
No dice... The file is empty and I can't right click to save target as...  :-\
Title: Re: Where to insert Banner invocation code
Post by: Jay? on September 13, 2004, 03:04:40 PM
It has been fixed - sorry about that.  BTW - the link was also updated!

It did not like tring to download the .php extension - so I zipped it real quick.

Title: Re: Where to insert Banner invocation code
Post by: JeF4y on September 13, 2004, 04:06:56 PM
7 hours, no luck...  my GOD why is this so hard  >:(

Jay, I tried to look through your template, but I see nothing related to my banner code or anything resembling banner invocation code on the lines you mention (or surrounding areas).

I've tried inserting it in various places, but either it comes up in locations that make no sense, or the entire page stops working...

This is frustrating as hell because I know html pretty good, but PHP simply makes no sense to me.  I can't figure out the relationships and structures.  The claim of these templates being "written in html inside of the php" is about the farthest thing from the truth. 

Sorry for venting, I just can't stand wasting this much time on something so seemingly simple.

If anyone can help, please please do...
Title: Re: Where to insert Banner invocation code
Post by: Jay? on September 13, 2004, 04:53:29 PM
Okay e-mail me your template file, and your invocation code (php version) and I will put it all together.

Or get me on IM and I will work with you there..
Title: Re: Where to insert Banner invocation code
Post by: JeF4y on September 13, 2004, 05:19:06 PM
Jay,

Thank you again for your offer to help.  I just emailed you the particulars.  The forum is located at
www.cbr1000rr.net/forum  if you're interested.

Thanks again.
Title: Re: Where to insert Banner invocation code
Post by: [Unknown] on September 14, 2004, 02:15:11 AM
Add this code:

<center>
<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://www.cbr1000rr.net/phpAdsNew-2.0/adjs.php?n=" + phpAds_random);
   document.write ("&amp;what=zone:1");
   document.write ("&amp;exclude=" + document.phpAds_used);
   if (document.referer)
      document.write ("&amp;referer=" + escape(document.referer));
   document.write ("\"><" + "/script>");
//-->
</script><noscript><a href="http://www.cbr1000rr.net/phpAdsNew-2.0/adclick.php?n=aa4398ed" target="_blank"><img src="http://www.cbr1000rr.net/phpAdsNew-2.0/adview.php?what=zone:1&amp;n=aa4398ed" border="0" alt=""></a></noscript>
</center>


-[Unknown]
Title: Re: Where to insert Banner invocation code
Post by: JeF4y on September 14, 2004, 07:45:17 AM
Quote from: [Unknown] on September 14, 2004, 02:15:11 AM
Add this code:


Well, yeah!  This is the code I provided above that I need to add somewhere, but the question is where!?!
Title: Re: Where to insert Banner invocation code
Post by: Jay? on September 14, 2004, 10:52:43 AM
Provide the php version of the invocation code..

Title: Re: Where to insert Banner invocation code
Post by: JeF4y on September 14, 2004, 11:35:36 AM
Jay,

Here's the code.  I emailed this to you this morning...  For reference, I have *never* been able to get local mode invocation to work with any banners, and IIRC, it will not work with flash banners.  However, remote for javascript has always worked.

Anyhow, here it is...

<?php
    if (@include(getenv('DOCUMENT_ROOT').'/phpAdsNew-2.0/phpadsnew.inc.php')) {
        if (!isset($phpAds_context)) $phpAds_context = array();
        $phpAds_raw = view_raw ('zone:1', 0, '', '', '0', $phpAds_context);
        echo $phpAds_raw['html'];
    }
?>
Title: Re: Where to insert Banner invocation code
Post by: [Unknown] on September 14, 2004, 12:54:11 PM
Quote from: JeF4y on September 14, 2004, 07:45:17 AM
Quote from: [Unknown] on September 14, 2004, 02:15:11 AM
Add this code:


Well, yeah!  This is the code I provided above that I need to add somewhere, but the question is where!?!

No, actually, I changed it considerably - this one would actually work.  Where do you want it?

-[Unknown]
Title: Re: Where to insert Banner invocation code
Post by: JeF4y on September 14, 2004, 04:25:38 PM
http://www.cbr1000rr.net/forum

Centered Above or Below the buttons (home/help/search/etc) or even centered in the top of the darker gray background that start the forum topics (next to the folder - cbr1000rr)

Title: Re: Where to insert Banner invocation code
Post by: JeF4y on September 14, 2004, 09:42:24 PM
Quote from: [Unknown] on September 14, 2004, 02:15:11 AM
No, actually, I changed it considerably - this one would actually work.  Where do you want it?

-[Unknown]

Ahhh. now I see the differences.  However, I can't find where to put it.  I keep trying sensible areas, like after the section that show folder_open.gif in index.template.php, but anywhere that I put it either winds up at the top of the page, or the page comes up totally blank (as in no forum showing up)
Title: Re: Where to insert Banner invocation code
Post by: [Unknown] on September 14, 2004, 11:25:09 PM
Find:

// Show the menu here, according to the menu sub template.
template_menu();

echo '
</div>';


Replace:
// Show the menu here, according to the menu sub template.
template_menu();

echo '
</div>

THE CODE I GAVE YOU HERE.

';


-[Unknown]
Title: Re: Where to insert Banner invocation code
Post by: JeF4y on September 15, 2004, 07:58:44 AM
THANK YOU THANK YOU THANK YOU!!!!!

Many hours & much frustration now over. 

Performing *exactly* as I expect.  Thank you so much, once again...  (if you ever have any motorcycle needs, come see me!!)

-Jeff
Title: Re: Where to insert Banner invocation code
Post by: Elijah Bliss on September 28, 2004, 07:06:01 AM
Quote from: [Unknown] on September 14, 2004, 02:15:11 AM
Add this code:



<!--
   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://www.cbr1000rr.net/phpAdsNew-2.0/adjs.php?n=" + phpAds_random);
   document.write ("&amp;what=zone:1");
   document.write ("&amp;exclude=" + document.phpAds_used);
   if (document.referer)
      document.write ("&amp;referer=" + escape(document.referer));
   document.write ("\"><" + "/script>");
//-->



-[Unknown]

I'm afraid I need some help as well. I followed what you did to the javascript make this work in the index.template.php...
<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://www.blaqboard.com/banners/phpAdsNew-2.0/adjs.php?n=" + phpAds_random);
   document.write ("&amp;what=zone:1");
   document.write ("&amp;exclude=" + document.phpAds_used);
   if (document.referer)
      document.write ("&amp;referer=" + escape(document.referer));
   document.write ("\"><" + "/script>");
//-->
</script><noscript><a href="http://www.blaqboard.com/banners/phpAdsNew-2.0/adclick.php?n=ab350813" target="_blank"><img src="http://www.blaqboard.com/banners/phpAdsNew-2.0/adview.php?what=zone:1&amp;n=ab350813" border="0" alt=""></a></noscript>


but not matter where I place it it doesn't work. I tested the unmodified code on a regular html page and it's working. Very frustrating to say the least.
Title: Re: Where to insert Banner invocation code
Post by: Elijah Bliss on September 28, 2004, 07:10:50 AM
I removed the <noscript> tags and things are working now. Before I get excited, are the <noscript> tags a necessity or can I get away with not using them?
Title: Re: Where to insert Banner invocation code
Post by: [Unknown] on September 28, 2004, 06:24:28 PM
Without the noscript, people can turn off JavaScript to turn off your ads.

But... that shouldn't have caused a problem.  There aren't any single quotes in there, are there?

-[Unknown]
Title: Re: Where to insert Banner invocation code
Post by: Elijah Bliss on September 28, 2004, 08:43:25 PM
Quote from: [Unknown] on September 28, 2004, 06:24:28 PM
Without the noscript, people can turn off JavaScript to turn off your ads.

But... that shouldn't have caused a problem.  There aren't any single quotes in there, are there?

-[Unknown]

Well, I tested the script sans the <noscript> tags in IE6, Safari, and Firefox, with javascript enabled, and without javascript enabled, and all the AdViews are registering as they should.

With the <noscript> tags the banner wouldn't show up at all.
Title: Re: Where to insert Banner invocation code
Post by: [Unknown] on September 29, 2004, 03:49:29 AM
Quote from: Elijah Bliss on September 28, 2004, 08:43:25 PM
With the <noscript> tags the banner wouldn't show up at all.

That's strange.  What "noscript" is for is providing an alternative for browsers that don't support JavaScript or don't have it enabled.

-[Unknown]
Title: Re: Where to insert Banner invocation code
Post by: Elijah Bliss on September 29, 2004, 01:06:28 PM
Quote from: [Unknown] on September 29, 2004, 03:49:29 AM
Quote from: Elijah Bliss on September 28, 2004, 08:43:25 PM
With the  tags the banner wouldn't show up at all.

That's strange.  What "noscript" is for is providing an alternative for browsers that don't support JavaScript or don't have it enabled.

-[Unknown]

Now the invocation code with the noscript tags works fine in a basic html and php document. Could there be some javascript conflict in SMF?
Title: Re: Where to insert Banner invocation code
Post by: Elijah Bliss on September 29, 2004, 01:38:38 PM
So I tested the invocation code, placed in the index.template.php sans the noscript tags in Netscape Communicator 4.8 and IE5 with javascript disabled and everything worked, the banner appeared, and my adviews were registering. For all intents and purposes it's working, and I believe I covered all my bases, although I may be alienating some Netscape 3.0 users.
Title: Re: Where to insert Banner invocation code
Post by: [Unknown] on September 29, 2004, 02:16:39 PM
Quote from: Elijah Bliss on September 29, 2004, 01:38:38 PM
So I tested the invocation code, placed in the index.template.php sans the noscript tags in Netscape Communicator 4.8 and IE5 with javascript disabled and everything worked, the banner appeared, and my adviews were registering. For all intents and purposes it's working, and I believe I covered all my bases, although I may be alienating some Netscape 3.0 users.

Who cares about Netscrape 3/4 :P?

-[Unknown]
Title: Re: Where to insert Banner invocation code
Post by: JCphotog on August 29, 2006, 02:02:34 PM
I'm sorry to bring back an old topic, though this is a great topic. I was able to get a banner showing at the bottom of my forum.  Everything looked great untill one user wanted to post a flash banner.  It resolves well in Safari, Netscape, Firefox, but not in IE.  Any thoughts?