News:

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

Main Menu

Where to insert Banner invocation code

Started by JeF4y, September 13, 2004, 08:49:43 AM

Previous topic - Next topic

JeF4y

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

Vinoth

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
Vinoth And Sachin ( SpecHackers Team )
The Best  Way to Help Poor Is not Becoming One Of Them.

JeF4y

"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>

Jay?

If you have not finished this up yet.  Let me know - I'll PM you my header that has the AD's installed.

-Jay

JeF4y

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) )

Jay?

#5
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


-Jay

JeF4y

No dice... The file is empty and I can't right click to save target as...  :-\

Jay?

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.

-Jay

JeF4y

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...

Jay?

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..
-Jay

JeF4y

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.

[Unknown]

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]

JeF4y

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!?!

Jay?

Provide the php version of the invocation code..

-Jay

JeF4y

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'];
    }
?>

[Unknown]

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]

JeF4y

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)


JeF4y

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)

[Unknown]

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]

JeF4y

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

Elijah Bliss

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.

Elijah Bliss

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?

[Unknown]

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]

Elijah Bliss

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.

[Unknown]

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]

Elijah Bliss

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?

Elijah Bliss

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.

[Unknown]

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]

JCphotog

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?

Advertisement: