uncomment comment in php

Status
Not open for further replies.

galaxyAbstractor

Community Advocate
Community Support
Messages
5,508
Reaction score
35
Points
48
look at this code:
PHP:
define("TPL_BANNER_TOP_CODE"        ,    "<br/>
<table align=\"center\">
<tr>
<td>
<script type="text/javascript" src="http://x10hosting.com/adserve.js?viggeswe"></script>
<script type="text/javascript"><!--
google_ad_client = "pub-0148207174309975";
//468x60, skapad 2007-12-25
google_ad_slot = "6062133011";
google_ad_width = 468;
google_ad_height = 60;
//--></script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</td>
</tr>
</table>
<br/>
");
Notice this:
PHP:
//x10hosting.com/adserve.js?viggeswe"></script>

It is a comment... How to uncomment it?
 

galaxyAbstractor

Community Advocate
Community Support
Messages
5,508
Reaction score
35
Points
48
do you mean like this?:

PHP:
<script type="text/javascript" src="http:\//\x10hosting.com/adserve.js?viggeswe"></script>

It still showing: Parse error: syntax error, unexpected T_STRING in /home/viggeswe/public_html/si/include/template.php on line 45

The x10 ad is line 45
 
Last edited:

DefecTalisman

Community Advocate
Community Support
Messages
4,148
Reaction score
5
Points
38
more like

PHP:
"http:\/\/x10hosting.com\/adserve.js?viggeswe"
 
Last edited:

Penguin129

New Member
Messages
68
Reaction score
0
Points
0
You need to escape all the quotes in the string in the quotes for the function. On the first post, php will read that as:
PHP:
define("TPL_BANNER_TOP_CODE"        ,    "<br/>
<table align=\"center\">
<tr>
<td>
<script type="
Then reach a string that it has no idea what it's for and give a error about an unexpected string.

PHP:
define("TPL_BANNER_TOP_CODE"        ,    "<br/>
<table align=\"center\">
<tr>
<td>
<script type=\"text/javascript\" src=\"http://x10hosting.com/adserve.js?viggeswe\"></script>
<script type=\"text/javascript\"><!--
google_ad_client = \"pub-0148207174309975\";
//468x60, skapad 2007-12-25
google_ad_slot = \"6062133011\";
google_ad_width = 468;
google_ad_height = 60;
//--></script>
<script type=\"text/javascript\"
src=\"http://pagead2.googlesyndication.com/pagead/show_ads.js\">
</script>
</td>
</tr>
</table>
<br/>
");
Escaping the // is unnecessary in this case because php will interpret it as part of the string in this case instead of interpreting it as a comment. Also notice that the whole string is one colour instead of multiple colours.
 
Last edited:
Status
Not open for further replies.
Top