Welcome to WebmasterWorld Guest from

Forum Moderators: incrediBILL & martinibuster

Message Too Old, No Replies

Couple of questions about a php site



1:36 pm on Jun 13, 2005 (gmt 0)

10+ Year Member

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

5:46 pm on Jun 13, 2005 (gmt 0)

10+ Year Member

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.


6:19 pm on Jun 13, 2005 (gmt 0)

10+ Year Member

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 :)


7:32 pm on Jun 13, 2005 (gmt 0)

10+ Year Member

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.


2:13 pm on Jun 14, 2005 (gmt 0)

10+ Year Member

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.


8:42 pm on Jun 30, 2005 (gmt 0)

10+ Year Member

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.


Featured Threads

Hot Threads This Week

Hot Threads This Month