Simple Machines Community Forum

General Community => Scripting Help => Topic started by: SKETCHi on April 29, 2005, 09:45:12 PM

Title: Need phpAdsNew Help
Post by: SKETCHi on April 29, 2005, 09:45:12 PM
Alright, I've searched and found nothing. The only helpful bit of information was on how to use the javascript code, which doesn't help me. I'm using the php code provided by phpAdsNew, how can I get it to work with SMF?

Here is the code.
<?php
   
if (@include(getenv('DOCUMENT_ROOT').'/adsnew/phpadsnew.inc.php')) {
        if (!isset($phpAds_context)) $phpAds_context = array();
        $phpAds_raw = view_raw ('zone:1', 0, '', '', '0', $phpAds_context);
        echo $phpAds_raw['html'];
    }
?>


Here is the JavaScript code that doesn't work either. Even with the "fix" from another thread.
<script language='JavaScript' type='text/javascript' src='http://graphicaddicts.net/adsnew/adx.js'></script>
<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://graphicaddicts.net/adsnew/adjs.php?n=" + phpAds_random);
   document.write ("&amp;what=zone:1");
   document.write ("&amp;exclude=" + document.phpAds_used);
   if (document.referrer)
      document.write ("&amp;referer=" + escape(document.referrer));
   document.write ("'><" + "/script>");
//-->
</script><noscript><a href='http://graphicaddicts.net/adsnew/adclick.php?n=a95af63c' target='_blank'><img src='http://graphicaddicts.net/adsnew/adview.php?what=zone:1&amp;n=a95af63c' border='0' alt=''></a></noscript>
Title: Re: Need phpAdsNew Help
Post by: SKETCHi on April 30, 2005, 12:43:10 AM
Anyone?
Title: Re: Need phpAdsNew Help
Post by: [Unknown] on April 30, 2005, 12:52:22 AM
Use:

';
    if (@include(getenv('DOCUMENT_ROOT').'/adsnew/phpadsnew.inc.php')) {
        if (!isset($phpAds_context)) $phpAds_context = array();
        $phpAds_raw = view_raw ('zone:1', 0, '', '', '0', $phpAds_context);
        echo $phpAds_raw['html'];
    }
echo '


Or:

<script language="JavaScript" type="text/javascript" src="http://graphicaddicts.net/adsnew/adx.js"></script>
<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://graphicaddicts.net/adsnew/adjs.php?n=" + phpAds_random);
   document.write ("&amp;what=zone:1");
   document.write ("&amp;exclude=" + document.phpAds_used);
   if (document.referrer)
      document.write ("&amp;referer=" + escape(document.referrer));
   document.write ("\'><" + "/script>");
//-->
</script><noscript><a href="http://graphicaddicts.net/adsnew/adclick.php?n=a95af63c" target="_blank"><img src="http://graphicaddicts.net/adsnew/adview.php?what=zone:1&amp;n=a95af63c" border="0" alt=""></a></noscript>


-[Unknown]
Title: Re: Need phpAdsNew Help
Post by: SKETCHi on April 30, 2005, 10:00:27 PM
Neither of those worked. The PHP gave me an error and the JavaScript simply didn't show the banners, but atleast the page loaded...
Title: Re: Need phpAdsNew Help
Post by: [Unknown] on May 01, 2005, 12:25:07 AM
Post 5 lines above and below of what you're trying with the PHP.

-[Unknown]
Title: Re: Need phpAdsNew Help
Post by: SKETCHi on May 05, 2005, 02:12:44 PM
Well, it turns out that the Java does work... but only for Windows. A good amount of Mac users visit my website also, I need it to work for them too.

Also, what do you mean by 5 lines above or below? Wouldn't that put a huge gap on the page?
Title: Re: Need phpAdsNew Help
Post by: [Unknown] on May 05, 2005, 04:14:05 PM
Please copy and paste 5 lines above and 5 lines below the code you're trying to put this into in index.template.php with the non-JavaScript solution (the first one.)

How do I modify files? (http://www.simplemachines.org/community/index.php?topic=24110.0)

-[Unknown]
Title: Re: Need phpAdsNew Help
Post by: SKETCHi on May 05, 2005, 06:59:10 PM
I put 5 lines between them and it still gives me an error. The JavaScript doesn't work with Mac OS9 and the PHP doesn't work period. Maybe something is slightly wrong with the PHP?
Title: Re: Need phpAdsNew Help
Post by: [Unknown] on May 05, 2005, 08:08:05 PM
Let's say you're trying to insert this code on line 50.  Please copy line 45 to line 55 (before inserting any code) and paste it in the little post box on your screen in your web browser.  Next, click the "Post" button.

This will post the code I wish you to show me on this forum, such that I can see it and tell you what you're doing wrong.

-[Unknown]