homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Google / Google AdSense
Forum Library, Charter, Moderators: incrediBILL & martinibuster

Google AdSense Forum

Couple of questions about a php site

5+ Year Member

Msg#: 7309 posted 1:36 pm on Jun 13, 2005 (gmt 0)

Does the TOS have anything against displaying ads generated by php? This might be stupid because I guess it makes no difference, cause it comes out the same but I rather ask:
echo "<script type=\"text/javascript\"><!--\n";
echo "google_ad_width = 120;\n";
echo "google_color_text = \"000000\";\n";
echo "//--></script>\n";
echo "<script type=\"text/javascript\"\n";

2)So I run a game site, and I want to have php based comment system under every game or other content. I want it to be suited for all audiances but at the same time it wont require registering. So I need a good language filter. Considering that and the AdSense ads, do you think i should filter obscene words $%#&# or just discard every comment suspected of being offensive.

3)All the comments can't be displayed on one site, cause with time it might clough up, so it needs some choose-a-page links. But like I said the comments are displayed under every content n ads, so do you think a ...game1.php?page=2 should open open a new blank page with only the comments or the whole page with content and ads thus possibly reducing the CTR (P.S. I'd rather not use frames)

4)Remind me pls the figuers of hom much ads you can have on one page. As I recall it was something like 3banner and 1link type ad but I'm not sure.



George Cooper

10+ Year Member

Msg#: 7309 posted 5:46 pm on Jun 13, 2005 (gmt 0)

Why would you echo each line of the google code? Using PHP to echo out static content doesn't really make sense... Just end the php code block and insert the html, then re-open the php code block


blah blah php code


<script >
// adsense code


continue php code



or if it really needs to be dynamically inserted,


echo '
google code


rather than line by line...

And as long as you're not modifying the adsense code in any way (ie, you're just pasting it straight in to the page), there's no problem with doing this.


5+ Year Member

Msg#: 7309 posted 6:19 pm on Jun 13, 2005 (gmt 0)

Yes I want it dynamically inserted cause it's a comment script that might be used twice or 20 times.

I used a new line for each line of the adsense scipt cause i think looks much clearer and is much easier to edit (i.e.colors) but I guess it really doesnt need that many echo's XD

But yeah, thx for the response :)


10+ Year Member

Msg#: 7309 posted 7:32 pm on Jun 13, 2005 (gmt 0)

MadMax101, generating the AdSense code via a server-side language doesn't violate the AdSense TOS. Even if it did, Google would have no way of knowing it was generated via PHP since the output would be identical to AdSense code embedded in an HTML file.

FYI, if the content within the echo statement contains no PHP code, you should use single quotes instead of double quotes. With single quotes, PHP just outputs the content between the quotes, with double quotes, PHP evaluates the content between the quotes, parsing it for PHP code, which is slower.


10+ Year Member

Msg#: 7309 posted 2:13 pm on Jun 14, 2005 (gmt 0)

I use extensively php to generate adsense cpde, but I strongly advice against doing something like:

echo "//--></script>\n";

First of all, as already pointed out the use of double quotes puts you at risk of having php changing something inside the script, which is against TOS and might break something.

Second, what is the need to convert the copied block of javascript in several php lines?

I prefer to treat the copied js as a "black box" thing, without changing anything inside it.

If I have different variants of the ads (colors, channels, format etc.), I save the copied js in several small files and then include them in my php with include 'filename.php'.

In some cases, I found it useful to have a full library of js snippets, select the correct one via software and then include $filename.


5+ Year Member

Msg#: 7309 posted 8:42 pm on Jun 30, 2005 (gmt 0)

Since all my pages are generated via a somewhat convoluted php script onto a single predefined html template.....
Scripts that include //--> or <!-- refuse to show up, however using a script that doesnt have it, or one that i remove "<!--" or "//-->" shows up fine.

I was curious if removing this would jeopardize me in any way? I fail to see how it could be relevant, but I dont really want to find myself banned over something insignificant.

Global Options:
 top home search open messages active posts  

Home / Forums Index / Google / Google AdSense
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved