Go Back   Computer Forums > Web Design | Website Development > Web Programming
Click Here to Login
Join Computer forums Today


Reply
 
Thread Tools Search this Thread Display Modes
 
Old 06-05-2006, 11:58 PM   #1
In Runtime
 
Join Date: May 2006
Posts: 148
Default Php & Html

Can I insert this html code

<!-- Start of StatCounter Code -->
<script type="text/javascript" language="javascript">
var sc_project=1621564;
var sc_invisible=1;
var sc_partition=15;
var sc_security="578f130d";
var sc_remove_link=1;
</script>

<script type="text/javascript" language="javascript" src="http://www.statcounter.com/counter/counter.js"></script><noscript><img src="http://c16.statcounter.com/counter.php?sc_project=1621564&java=0&security=578 f130d&invisible=0" alt="web stats analysis" border="0"> </noscript>
<!-- End of StatCounter Code -->

in a php file that says this?

<?php
/*---------------------------------------------------+
| PHP-Fusion 6 Content Management System
+----------------------------------------------------+
| Copyright © 2002 - 2005 Nick Jones
| http://www.php-fusion.co.uk/
+----------------------------------------------------+
| Released under the terms & conditions of v2 of the
| GNU General Public License. For details refer to
| the included gpl.txt file or visit http://gnu.org
+----------------------------------------------------*/
require_once "maincore.php";

redirect($settings['opening_page']);
?>

Thanks!
__________________

chougard is offline   Reply With Quote
Old 06-06-2006, 05:58 AM   #2
Site Team
 
root's Avatar
 
Join Date: Mar 2004
Posts: 8,006
Default Re: PHP & HTML

Yes...
Code:
<?php
/*---------------------------------------------------+
| PHP-Fusion 6 Content Management System
+----------------------------------------------------+
| Copyright © 2002 - 2005 Nick Jones
| http://www.php-fusion.co.uk/
+----------------------------------------------------+
| Released under the terms & conditions of v2 of the
| GNU General Public License. For details refer to
| the included gpl.txt file or visit http://gnu.org
+----------------------------------------------------*/
require_once "maincore.php";

print "<!-- Start of StatCounter Code -->
<script type=\"text/javascript\" language=\"javascript\">
var sc_project=1621564; 
var sc_invisible=1; 
var sc_partition=15; 
var sc_security=\"578f130d\"; 
var sc_remove_link=1; 
</script>

<script type=\"text/javascript\" language=\"javascript\" src=\"http://www.statcounter.com/counter/counter.js\"></script><noscript><img src=\"http://c16.statcounter.com/counter.php?sc_project=1621564&java=0&security=578f130d&invisible=0\" alt=\"web stats analysis\" border=\"0\"> </noscript>
<!-- End of StatCounter Code -->";

redirect($settings['opening_page']);
?>
But I'm not really sure I get why you would do this since as soon as the page is loaded it redirects to another page.
Code:
redirect($settings['opening_page']);
__________________

__________________
I didn’t fight my way to the top of the food chain to be a vegetarian…
Im sick of people saying 'dont waste paper'. If trees wanted to live, they'd all carry guns.
"The inherent vice of capitalism is the unequal sharing of blessings; The inherent vice of socialism is the equal sharing of miseries."
root is offline   Reply With Quote
Old 06-06-2006, 11:22 AM   #3
In Runtime
 
Join Date: May 2006
Posts: 148
Default Re: PHP & HTML

Thanks! So if I ever have to do it again, I would type in
Code:
print "code"
right?
chougard is offline   Reply With Quote
Old 06-06-2006, 11:31 AM   #4
Site Team
 
root's Avatar
 
Join Date: Mar 2004
Posts: 8,006
Default Re: PHP & HTML

yes..


you use either print "code";

or echo 'code';

but bear in mind that whenever you open a statement with print " <-quote, it ends with another quote

so it you have quote marks in the code they have to be escaped with the escape char \

so this won't work
print "<img src="example.jpg">";

but this will

print "<img src=\"example.jpg\">";
__________________
I didn’t fight my way to the top of the food chain to be a vegetarian…
Im sick of people saying 'dont waste paper'. If trees wanted to live, they'd all carry guns.
"The inherent vice of capitalism is the unequal sharing of blessings; The inherent vice of socialism is the equal sharing of miseries."
root is offline   Reply With Quote
Old 06-06-2006, 11:43 AM   #5
In Runtime
 
Join Date: May 2006
Posts: 148
Default Re: PHP & HTML

I followed your instructions and put this:
Code:
print "<!-- Start of StatCounter Code -->
<script type=\text/javascript\ language=\javascript\>
var sc_project=1621564; 
var sc_invisible=1; 
var sc_partition=15; 
var sc_security="578f130d\; 
var sc_remove_link=1; 
</script>

<script type=\text/javascript\ language=\javascript\ src=\http://www.statcounter.com/counter/counter.js\></script><noscript><img  src=\http://c16.statcounter.com/counter.php?sc_project=1621564&java=0&security=578f130d&invisible=0\ alt=\simple hit counter\ border=\0\> </noscript>
<!-- End of StatCounter Code -->"
in a php file. Now I get an error that says "
Parse error: parse error, unexpected T_LNUMBER in /home/www/runekillerz.awardspace.com/phpBB2/index.php on line 475". When I take out the code, it works just fine but when I put it back in it does not. What did I do wrong? What you gave me in the first reply works fine.



I tried the wrong way of what you wrote here
Quote:
so this won't work
print "<img src="example.jpg">";

but this will

print "<img src=\"example.jpg\">";
The php file works just fine when I use this method
Code:
print "<img src="example.jpg">";
and not this method
Code:
print "<img src=\"example.jpg\">";
chougard is offline   Reply With Quote
Old 06-06-2006, 04:37 PM   #6
Site Team
 
root's Avatar
 
Join Date: Mar 2004
Posts: 8,006
Default Re: PHP & HTML

The error refers to the fact that the script has found something that it didn't expect, for example if you miss a semi colon from the end of a statement you'll get an error like that, since the script interperetor expects a semi colon, or a boolean opperator to tie some functions together.
alternativly the error could be caused by missing a escape charector before a quote mark, since the script interperator assumes thats the end of the statement, and again expects a semi colon.

Quote:
print "<!-- Start of StatCounter Code -->
<script type=\text/javascript\ language=\javascript\>
var sc_project=1621564;
var sc_invisible=1;
var sc_partition=15;
var sc_security="578f130d\;
var sc_remove_link=1;
</script>

<script type=\text/javascript\ language=\javascript\ src=\http://www.statcounter.com/counter/counter.js\></script><noscript><img src=\http://c16.statcounter.com/counter.p...d&invisible=0\ alt=\simple hit counter\ border=\0\> </noscript>
<!-- End of StatCounter Code -->"
I can tell you that if that's the code, then it's most likely that you've missed the semi colon from the end.

however, I don't quite understand why you've removed all the quote marks, (and left in the escape chars).
__________________
I didn’t fight my way to the top of the food chain to be a vegetarian…
Im sick of people saying 'dont waste paper'. If trees wanted to live, they'd all carry guns.
"The inherent vice of capitalism is the unequal sharing of blessings; The inherent vice of socialism is the equal sharing of miseries."
root is offline   Reply With Quote
Old 06-06-2006, 11:29 PM   #7
In Runtime
 
Join Date: May 2006
Posts: 148
Default Re: PHP & HTML

So this would be right?
Code:
print "<!-- Start of StatCounter Code -->
<script type=\"text/javascript\" language=\"javascript\">
var sc_project=1621564; 
var sc_invisible=1; 
var sc_partition=15; 
var sc_security=\"578f130d\"; 
var sc_remove_link=1; 
</script>

<script type=\"text/javascript\" language=\"javascript\" src=\"http://www.statcounter.com/counter/counter.js\"></script><noscript><img src=\"http://c16.statcounter.com/counter.php?sc_project=1621564&java=0&security=578f130d&invisible=0\" alt=\"web stats analysis\" border=\"0\"> </noscript>
<!-- End of StatCounter Code -->";
chougard is offline   Reply With Quote
Old 06-07-2006, 05:37 AM   #8
Site Team
 
root's Avatar
 
Join Date: Mar 2004
Posts: 8,006
Default Re: PHP & HTML

yes.
__________________
I didn’t fight my way to the top of the food chain to be a vegetarian…
Im sick of people saying 'dont waste paper'. If trees wanted to live, they'd all carry guns.
"The inherent vice of capitalism is the unequal sharing of blessings; The inherent vice of socialism is the equal sharing of miseries."
root is offline   Reply With Quote
Old 06-07-2006, 11:37 PM   #9
In Runtime
 
Join Date: May 2006
Posts: 148
Default Re: PHP & HTML

Thanks!
__________________

chougard is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off



All times are GMT -5. The time now is 03:13 PM.


Powered by vBulletin® Version 3.8.8 Beta 4
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Search Engine Friendly URLs by vBSEO 3.6.0