Welcome to Geeklog, Anonymous Saturday, November 30 2024 @ 12:49 am EST
Geeklog Forums
Google php block
NOT so handyman
Anonymous
Hi i am realy new to php.. Today actually.. But i am trying to make a google ad sence block with php and am not sure whats wrong with it and if im doing it correctly. This is my code in the lib_common.php file and in the block i choose phpblock and put phpblock_googlead . any help would be appreciated thanks.
function phpblock_googlead()
{
echo '
google_ad_client = "pub-**************467";
google_ad_width = 120;
google_ad_height = 600;
google_ad_format = "120x600_as";
google_ad_type = "text_image";
google_ad_channel ="";
google_page_url = document.location;
google_color_border = "191933";
google_color_bg = "333366";
google_color_link = "99CC33";
google_color_url = "FFCC00";
google_color_text = "FFFFFF";
';
$content .= '
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
';
}
function phpblock_googlead()
{
echo '
google_ad_client = "pub-**************467";
google_ad_width = 120;
google_ad_height = 600;
google_ad_format = "120x600_as";
google_ad_type = "text_image";
google_ad_channel ="";
google_page_url = document.location;
google_color_border = "191933";
google_color_bg = "333366";
google_color_link = "99CC33";
google_color_url = "FFCC00";
google_color_text = "FFFFFF";
';
$content .= '
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
';
}
13
12
Quote
Status: offline
asmaloney
Forum User
Full Member
Registered: 02/08/04
Posts: 214
You probably want something more like this:
Text Formatted Code
function phpblock_googlead()
{
echo '
<div align=center>
<script type="text/javascript"><!--
google_ad_client = "pub-***********";
...
google_color_text = "6F6F6F";
//--></script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</div>';
}
Of course I haven't tried it - I'm a developer not a tester!
- Andy
9
13
Quote
Status: offline
beewee
Forum User
Full Member
Registered: 08/05/03
Posts: 969
Location:The Netherlands, where else?
Perhaps I've missed something, but what's wrong with putting the normal Adsense javascript code in an normal block or static page? It always worked fine for me.
Dutch Geeklog sites about camping/hiking:
www.kampeerzaken.nl | www.campersite.nl | www.caravans.nl | www.caravans.net
Dutch Geeklog sites about camping/hiking:
www.kampeerzaken.nl | www.campersite.nl | www.caravans.nl | www.caravans.net
13
14
Quote
ddgeek.com
Anonymous
for some reason the javascript isnt working for me, the ads arent appearing, im not sure whats to blame at the moment though.
15
13
Quote
Status: offline
loculus
Forum User
Newbie
Registered: 07/01/05
Posts: 14
This is just a guess as I'm learning too but if the error is indicating that the protocal is incorrect, then maybe you just have a typo or corrupt cut and paste of your Google code.
The only reason I say this is because when I cut and paste my own Google code into a basic html block some of the code was changed enough to give me some extra characters such as ->.
To solve it, I just tried again and it worked perfectly.
The only reason I say this is because when I cut and paste my own Google code into a basic html block some of the code was changed enough to give me some extra characters such as ->.
To solve it, I just tried again and it worked perfectly.
12
16
Quote
All times are EST. The time is now 12:49 am.
- Normal Topic
- Sticky Topic
- Locked Topic
- New Post
- Sticky Topic W/ New Post
- Locked Topic W/ New Post
- View Anonymous Posts
- Able to post
- Filtered HTML Allowed
- Censored Content