Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> v2.4 RN Issues
Author Message
kingjames
Hangin' Around



Joined: Sep 27, 2011
Posts: 33

PostPosted: Tue Nov 22, 2011 5:50 am Reply with quote

Where to start, I am trying to get Adsense to display on my site, I made a block with the Adsense code but it is only displaying in the home section of my website, not an ideal situation. If there was a line of code I could add to make this block display on all the pages of my site this would be perfect, but I have no idea if this is possible.

Anyway so I didn't have to pester you guys with another Google Adsense question I tried searching here and found this thread about adding the code in your theme.php, but the thread was dated 2004 and the exact placement of the code eludes me since RN only vaguely resembles the code snippet that they quoted to look for and the code to add.

http://www.ravenphpscripts.com/postxf2482-0-0.html

Next I tried the "Google Ads Header and Footer Mod" in your download section well after downloading the file three times and being unable to open the zip it says "the compressed folder is empty" now I can plainly see from the fact that it is 8K that it is NOT empty so maybe I am just using the wrong program to unzip it. So that hasn't worked either.

http://www.ravenphpscripts.com/article1108.html

So if someone here can help me I would appreciate it, I don't have to have an answer to all three questions just one, hopefully the easiest one. Thanks.
 
View user's profile Send private message
nuken
RavenNuke(tm) Development Team



Joined: Mar 11, 2007
Posts: 2024
Location: North Carolina

PostPosted: Tue Nov 22, 2011 9:16 am Reply with quote

I just used the advertising module to add adsense ads by clicking the source button and pasting the supplied google code. The ads will not show up when you are in the admin section of your site, but they will when you are viewing any public part of your site.

_________________
Only registered users can see links on this board! Get registered or login! 
View user's profile Send private message Send e-mail Visit poster's website
kingjames







PostPosted: Tue Nov 22, 2011 12:33 pm Reply with quote

Thanks Nuken, that fixed the problem of the Adsense not displaying on every page, but I want the banner to display farther down on the page, I tried adjusting the position in my theme.file by changing "the code: ads(o);" to different numbers but it didn't seem to work.
 
fkelly
Former Moderator in Good Standing



Joined: Aug 30, 2005
Posts: 3312
Location: near Albany NY

PostPosted: Tue Nov 22, 2011 1:25 pm Reply with quote

All that ads(0) [that's a zero by the way] does is find all ads that have position number 0 in the advertising table. When you set up ads, you assign them an ads position. Then many themes call ads(0) and ads(1) in their header function and the ads show up at that point in page generation. So, changing the number of the parameter in ads( ) is not going to accomplish anything except perhaps select an ad that has been set up with a different ads position #. Again: ads position number has nothing to do with placement on the page.

If you want to position the ad somewhere else you can use the block-advertising as a template. In advertising administration set up your ad and give it a different position than 0 or 1. Then modify block-advertising (or better make a copy and leave the template out in the blocks directory. Call it say block-advertisingx. If you use say, position 4 for the ad in the advertising admin when you set up the ad then change the call to ads(0) to be ads(4). Now in blocks administration put the block wherever you want (left, right, center down, center up) and in the order you want. If you are using a left or right block you will want to make the content of the block fairly narrow. If it is going to be a center block then it can be a bit wider.
 
View user's profile Send private message Visit poster's website
fkelly







PostPosted: Tue Nov 22, 2011 1:34 pm Reply with quote

I just checked the documentation I wrote in the RNwiki at:

Only registered users can see links on this board! Get registered or login!

It says:
Quote:
As of RavenNukeā„¢ 2.40.00 the themes show ads that are in position 0 whereas the block file shows ads that are in position 1. This of course can be modified and/or you can clone the advertising block using a different block name to show ads from different positions.


I just double checked the theme files in the upcoming 2.5 distribution and they conform to this. Also, the block file calls ads(1). So you can safely use position 1 for any ad that's going to be called by the advertising block. Or you can clone that block and use different positions to scatter ads around your site.
 
kingjames







PostPosted: Tue Nov 22, 2011 7:59 pm Reply with quote

I am about to give up here on this one. Despite all the good advice and suggestions I can't get this to work. fkelly when I use the block advertising in conjunction with the advertising module I can in fact place the add wherever on the page I want it. It only displays on my main home page though.

When I set up the advertising module without using the block advertising as a template the ad is in a fixed position but it appears everywhere on my site not just the main home page. What I want is a some way to do both, to be able to place the add wherever on the page I want and to have it display on every public page on my site.
 
kingjames







PostPosted: Tue Nov 22, 2011 8:30 pm Reply with quote

Maybe this will help someone be able to help me. This is how I was doing it in .php nuke before I upgraded to RN. When I first started with RN I tried this but it didn't work. The only thing I changed was my pub # obviously.

I created a file called adsense.php (file contents below), placed it in my root and added, include ("adsense.php"); at the bottom of my header.php file.

<?php
if (eregi("adsense.php", $_SERVER['PHP_SELF'])) {
Footer("Location: index.php");
die();
}
opentable();
echo "<script type=\"text/javascript\"><!--\n"
."google_ad_client = \"pub-XXXXXXXXXXXXXX\"\n"
."google_ad_width = 468\n"
."google_ad_height = 60\n"
."google_ad_format = \"468x60_as\"\n"
."//--></script>\n"
."<center><script type=\"text/javascript\" src=\"http://pagead2.googlesyndication.com/pagead/show_ads.js\"></center>\n"
."</script>\n";
closetable();
?>
<br>
 
Guardian2003
Site Admin



Joined: Aug 28, 2003
Posts: 6799
Location: Ha Noi, Viet Nam

PostPosted: Fri Nov 25, 2011 6:08 am Reply with quote

Well, if you are including the file, you don't need all that extra code and you don't even need to php tags, just paste in your google adsense code exactly how you got it from google.

If you need to use the adverting module, as fkelly already mentioned, it is pretty straight forward but to re-cap;

In the advertising module, create new ad position, let us assume it is going to be used on the left column and the position number is 7.
Create your new ad by pasting in the adsense code from google (make sure to switch the wysiwyg editor to 'source' mode before pasting.

Next create a new PHP file in the /blocks/ directory, for simplicity, lets call it
block-LeftMiddle.php
inside that put the following code (after the PHP start tag
Code:


if ( !defined('BLOCK_FILE') ) {
    Header('Location: ../index.php');
    die();
}

$content = ads(7);


See how you go with that! Don't forget to make the block visible Smile
 
View user's profile Send private message Send e-mail
kingjames







PostPosted: Sat Nov 26, 2011 8:16 am Reply with quote

I still can't get this to work properly either it displays everywhere in the wrong position or in the proper position but only on the front page. It doesn't matter anymore though after as much help as has been given me either something is screwy in particular with my particular site (doubtful but possible) or I am still doing something wrong (more likely) anyway I am going to leave it as it is and move on to something else. Bang Head

BTW I was so impressed with all the help I have been given here that I Paypal donated you guys a few bucks, not as much as I would have liked but my site doesn't bring in much. When I first came here I was quite apprehensive about posting questions here as I figured I would either get no help at all, as has been the case with many other forums I visited, or that I would get smary cheeky responses that ridiculed my lack of knowledge of this subject, neither has happened here and I have been more than happy with the number of people that have bent over backwards to help me. You guys rock! Cheers
 
Guardian2003







PostPosted: Sat Nov 26, 2011 8:39 am Reply with quote

Positioning is dependant on the number assigned in your advertising module. If you have a position 6 then to make the adverts assigned to that position display on the page you use ads(6);

Block files are peculiar in that you have to assign anything you want visible on the page to the $content variable, which is why you have to do $content = ads(6); (for position number 6).

Don't forget that you can assign multiple ads to any given position and random ads for that specific position will be displayed.
 
semperaye
Worker
Worker



Joined: Oct 31, 2011
Posts: 100
Location: North Carolina

PostPosted: Wed Jan 16, 2013 1:31 pm Reply with quote

Guardian2003 wrote:
Well, if you are including the file, you don't need all that extra code and you don't even need to php tags, just paste in your google adsense code exactly how you got it from google.

If you need to use the adverting module, as fkelly already mentioned, it is pretty straight forward but to re-cap;

In the advertising module, create new ad position, let us assume it is going to be used on the left column and the position number is 7.
Create your new ad by pasting in the adsense code from google (make sure to switch the wysiwyg editor to 'source' mode before pasting.

Next create a new PHP file in the /blocks/ directory, for simplicity, lets call it
block-LeftMiddle.php
inside that put the following code (after the PHP start tag
Code:


if ( !defined('BLOCK_FILE') ) {
    Header('Location: ../index.php');
    die();
}

$content = ads(7);


See how you go with that! Don't forget to make the block visible Smile


i made the .php file but its not showing up in my blocks Sad also I do not know how to do that "includes" stuff either. is there a basic way to do this?!
 
View user's profile Send private message
semperaye







PostPosted: Wed Jan 16, 2013 1:33 pm Reply with quote

I would like to hire someone to do some basic work on my website let me know Smile
 
Guardian2003







PostPosted: Wed Jan 16, 2013 5:02 pm Reply with quote

Post in th 'For Hire' forum then. Wink
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> v2.4 RN Issues

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©