Posted on: 05/11/05 11:33am
By: Anonymous (NOT so handyman)
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">
';
}
Google php block
Posted on: 05/11/05 11:47am
By: asmaloney
You probably want something more like this:
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
Google php block
Posted on: 05/11/05 03:05pm
By: beewee
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.
Google php block
Posted on: 05/11/05 03:17pm
By: asmaloney
Uh, well.. sputter, sputter, but it, ah... whatabout the uh...
You're right - I should have thought of that instead of blindly solving his problem.
- Andy
Google php block
Posted on: 06/07/05 04:23am
By: Anonymous (ddgeek.com)
for some reason the javascript isnt working for me, the ads arent appearing, im not sure whats to blame at the moment though.
Google php block
Posted on: 06/07/05 10:06am
By: ronack
Have you set it in config as an allowable protocol?
// list of protocols that are allowed in links
$_CONF['allowed_protocols'] = array ('http:', 'https:', 'ftp:', 'javascript:');
Google php block
Posted on: 07/05/05 06:10pm
By: loculus
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.