Adsense on Right Side of News Module (Variation)

  Post new topicReply to topicPrintable Version
<< View previous topic View next topic >>
Share: Del.icio.us  Digg  Google  Spurl  Blink  Furl  Y! MyWeb  
#1   Adsense on Right Side of News Module (Variation)
Dauthus
CZ Addict
 Codezwiz Site Donator
Dauthus has been a member for over 20 year's 20 Year Member
usa.gif illinois.gif
Age: 61
Gender: Male
Website:
Status: Offline
Joined: Mar 17, 2004
0.06 posts per day
Posts: 426
Points: 15,917
   
While I was playing around with the Google Adsense on my site, I found a way to have the Adsense Ads included inside the "Related Links" box instead of outdise it with tables. If you aren't sure what exactly I am talking about, go here:
[ Register or login to view links on this board. ]

Here is the code I used, and where to place it.

-----[ OPEN ] -----

modules/News/article.php


-----[ FIND ] -----

themesidebox($boxtitle, $boxstuff);


-----[ ON A NEW LINE ABOVE ADD ] -----

$boxstuff .= "<br><center><s cript type=\"text/javasc ript\"><!--\n";
$boxstuff .= "google_ad_client = \"YourAdsenseClientID\";\n";
$boxstuff .= "google_ad_width = 120;\n";
$boxstuff .= "google_ad_height = 600;\n";
$boxstuff .= "google_ad_format = \"120x600_as\";\n";
$boxstuff .= "google_ad_channel =\"\";\n";
$boxstuff .= "google_color_border = \"669966\";\n";
$boxstuff .= "google_color_bg = \"99CC99\";\n";
$boxstuff .= "google_color_link = \"000000\";\n";
$boxstuff .= "google_color_url = \"00008B\";\n";
$boxstuff .= "google_color_text = \"336633\";\n";
$boxstuff .= "//--></s cript>\n";
$boxstuff .= "<s cript type=\"text/javas cript\"\n";
$boxstuff .= "src=\"http://pagead2.googlesyndication.com/pagead/show_ads.js\">\n";
$boxstuff .= "</s cript></center><br>\n";


Remove the space between the "s" and "c" in the words "script." You will also have to change the colors to fit your site. I just liked the idea of having it look like part of the block instead of having it as a new table.

Comments are welcome



_________________
[ Register or login to view links on this board.]
Vivere disce, cogita mori
Back to top Reply with quote
#2   re: Adsense on Right Side of News Module (Variation)
Bazil
CZ Super Newbie
Bazil has been a member for over 19 year's 19 Year Member
usa.gif florida.gif
Website:
Status: Offline
Joined: Dec 09, 2004
0.01 posts per day
Posts: 49
Points: 1,505
   
That is a nice mod, I like that better than the old way of having it in its own frame that never did match the theme. It fits alot better that way.. good job!



Back to top Reply with quote
#3   re: Adsense on Right Side of News Module (Variation)
Bazil
CZ Super Newbie
Bazil has been a member for over 19 year's 19 Year Member
usa.gif florida.gif
Website:
Status: Offline
Joined: Dec 09, 2004
0.01 posts per day
Posts: 49
Points: 1,505
   
themesidebox($boxtitle, $boxstuff);


That line apears twice on that page, can you descibe which one to look for ?

Also I am not to sure of how you meant to place it, do you mean to place the adsense code just before that line ?

Forgive me, I am a bit new to php.

Thanks!


Back to top Reply with quote
#4   re: Adsense on Right Side of News Module (Variation)
Dauthus
CZ Addict
 Codezwiz Site Donator
Dauthus has been a member for over 20 year's 20 Year Member
usa.gif illinois.gif
Age: 61
Gender: Male
Website:
Status: Offline
Joined: Mar 17, 2004
0.06 posts per day
Posts: 426
Points: 15,917
   
Here's the way it looks in my article.php

$row9 = $db->sql_fetchrow($db->sql_query("select sid, title from ".$prefix."_stories where topic='$topic' $querylang order by counter desc limit 0,1"));
$topstory = intval($row9['sid']);
$ttitle = stripslashes(check_html($row9['title'], "nohtml"));

$boxstuff .= "<a href=\"modules.php?name=$module_name&file=article&sid=$topstory\">$ttitle</a></font></center><br>\n";

$boxstuff .= "<br><center><s cript type=\"text/javas cript\"><!--\n";
$boxstuff .= "google_ad_client = \"pub-6546123987506640\";\n";
$boxstuff .= "google_ad_width = 120;\n";
$boxstuff .= "google_ad_height = 600;\n";
$boxstuff .= "google_ad_format = \"120x600_as\";\n";
$boxstuff .= "google_ad_channel =\"\";\n";
$boxstuff .= "google_color_border = \"000000\";\n";
$boxstuff .= "google_color_bg = \"848484\";\n";
$boxstuff .= "google_color_link = \"000000\";\n";
$boxstuff .= "google_color_url = \"FF0000\";\n";
$boxstuff .= "google_color_text = \"FFFFFF\";\n";
$boxstuff .= "//--></s cript>\n";
$boxstuff .= "<s cript type=\"text/javascript\"\n";
$boxstuff .= "src=\"http://pagead2.googlesyndication.com/pagead/show_ads.js\">\n";
$boxstuff .= "</s cript></center><br>\n";

themesidebox($boxtitle, $boxstuff);


Sorry about that. I didn't realize the code appeared twice.



_________________
[ Register or login to view links on this board.]
Vivere disce, cogita mori
Back to top Reply with quote
#5   
Telli
Site Admin
Occupation: Self Employed
Age: 46
Gender: Male
Fav. Sports Team: Detroit Red Wings
Website:
Status: Offline
Joined: May 26, 2003
1.03 posts per day
Posts: 8089
Points: 494,430
   
Instead of using the actual color hex use the theme $bgcolor1, $bgcolor2, $textcolor1 so it matches each theme.




_________________
The path of the righteous man is beset on all sides by the inequities of the selfish and the tyranny of evil men. Blessed is he, who in the name of charity and good will, shepherds the weak through the valley of darkness, for he is truly his brother's keeper and the finder of lost children. And I will strike down upon thee with great vengeance and furious anger those who would attempt to poison and destroy my brothers. And you will know my name is the Lord when I lay my vengeance upon thee. Ezekiel 25:17
Back to top Reply with quote
#6   
Dauthus
CZ Addict
 Codezwiz Site Donator
Dauthus has been a member for over 20 year's 20 Year Member
usa.gif illinois.gif
Age: 61
Gender: Male
Website:
Status: Offline
Joined: Mar 17, 2004
0.06 posts per day
Posts: 426
Points: 15,917
   



Instead of using the actual color hex use the theme $bgcolor1, $bgcolor2, $textcolor1 so it matches each theme.



Where exactly? Something like this?:

$boxstuff .= "google_color_border = \"000000\";\n";
$boxstuff .= "google_color_bg = \"$bgcolor1\";\n";
$boxstuff .= "google_color_link = \"000000\";\n";
$boxstuff .= "google_color_url = \"FF0000\";\n";
$boxstuff .= "google_color_text = \"$textcolor1\";\n";


Where would the $bgcolor2 go in this instance. Forgive my ignorance but I am terrible with themes and colors!! icon_redface.gif



_________________
[ Register or login to view links on this board.]
Vivere disce, cogita mori
Back to top Reply with quote
Display posts from previous:      
Add To: Del.icio.us  Digg  Google  Spurl  Blink  Furl  Y! MyWeb  
<< View previous topic View next topic >>
Post new topicReply to topic

Jump to 
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 cannot attach files in this forum
You cannot download files in this forum