Forward slash stripped from tags
Moderator: General Moderators
Forward slash stripped from tags
How do I stop forward slashes from being stripped from tags?
For example, if in php script I have:
<?php
...code
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
...more code
?>
the forward slash gets stripped (towards end of meta line) when page is loaded.
Tried several ways to get around it & am stumped.
This causes validation error for xhtml
I've tried:
<?php
code
?>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<?php
more code
?>
also:
<?php
code
echo '<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />'
more code
?>
and variations...driving me bonkers
For example, if in php script I have:
<?php
...code
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
...more code
?>
the forward slash gets stripped (towards end of meta line) when page is loaded.
Tried several ways to get around it & am stumped.
This causes validation error for xhtml
I've tried:
<?php
code
?>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<?php
more code
?>
also:
<?php
code
echo '<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />'
more code
?>
and variations...driving me bonkers
think I found source og glitch
pootergeist wrote:
tried "//>" and "\/>"
Actually, it is wierder and in actual page being viewed - if view source the "/>" is there as required.
I am running netscape 7.02 on Mac 10.2.3 - I think what is happening is not a PHP problem but a netscape bug.
When I save the file and the validate it the "/>" gets transformed into ">" and hence I get validation error.
I think what I need is an "escape" character for netscape
So, like I said not really a PHP problem...but was driving me nuts until I noticed it is with saved netscape files.
been there done that:you need to escape the slash with another slash
tried "//>" and "\/>"
Actually, it is wierder and in actual page being viewed - if view source the "/>" is there as required.
I am running netscape 7.02 on Mac 10.2.3 - I think what is happening is not a PHP problem but a netscape bug.
When I save the file and the validate it the "/>" gets transformed into ">" and hence I get validation error.
I think what I need is an "escape" character for netscape
So, like I said not really a PHP problem...but was driving me nuts until I noticed it is with saved netscape files.
they all stink big time!!!!!!
More:
when I browse the file and view source (Netscape or IE)
here is how the top part looks:
....blah blah blah
notice the </body> & </html> tags towards the top, lines 6 & 7
my code:
index.php contains this:
as you can see it has "include("tlf_inc.php");"
which read like this (at the top - did not include all of the code):
my code (php or html) does not have </html> or </body> them in lines 6 or 7.
This is driving me batty...ran a test.php script and it looks fine php 4.3.1
any help would be appreciated.
when I browse the file and view source (Netscape or IE)
here is how the top part looks:
Code: Select all
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
їb]</body>ї/b]
їb]</html>ї/b]
<title>2-leftfeet.net Home</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta name="Keywords" content="2-leftfeet.net, dance, dancing, instruction" />
<meta name ="Description" content ="homepage for 2-leftfeet.net" />
<link href="weblog.css" rel="stylesheet" type="text/css" />
</head>
<body>notice the </body> & </html> tags towards the top, lines 6 & 7
my code:
index.php contains this:
Code: Select all
<?php echo "<?xml version="1.0" encoding="iso-8859-1"?".">\n"; ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<?php
include("tlf_inc.php");
do_html_header('Home', '2-leftfeet.net, dance, dancing, instruction', 'Home page for 2-leftfeet.net', 'Home');
?>
<br />
<br />
body placeholder<br />
</body>
</html>which read like this (at the top - did not include all of the code):
Code: Select all
<?php
include("pm_inc.php");
function do_html_header($page_title, $usekeywords, $usedescription, $bread_crumb_text)
{
echo '<title>2-leftfeet.net ".$page_title."</title>';
?>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta name="Keywords" content="'.$usekeywords.'" />
<meta name ="Description" content ="homepage for 2-leftfeet.net" />
<link href="weblog.css" rel="stylesheet" type="text/css" />
</head>
<body>This is driving me batty...ran a test.php script and it looks fine php 4.3.1
any help would be appreciated.
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
uggh
well,
it gets more ocmplicated
tlf_inc.php in turn calls another include, which calls 4 more and on and on.
I suspect in one of those I have an ending tag(s0 hanging around.
So it is going to take me a while to find them (if they exist)
I wrote my last post late last night, brain not working.
out of frustration, in that instead of moving forward with the point of the porject I am bogged down in chasing forward slashes and then ending tags.
You know how it goes.
it gets more ocmplicated
tlf_inc.php in turn calls another include, which calls 4 more and on and on.
I suspect in one of those I have an ending tag(s0 hanging around.
So it is going to take me a while to find them (if they exist)
I wrote my last post late last night, brain not working.
You know how it goes.
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
Re: uggh
Sometimes things just refuse to work right. Hopefully though it won't take you too long to find the errant tags...tlfeet wrote:You know how it goes.
Mac
It's been a while
I haven't done html in a long while
...getting back into it.
Forgot how finicky it is - I mean all languages are - but html just does some plain wierd stuff.
Using dreamerweaver and in my includes of includes of includes...etc had let dreamweaver generate the basic page...no big deal but I had done this
<php?
blah blah blah
?>
</body>
</html>
on one of the includes and voila there are ther errant tags.
The finckyness also pops in the way netscape, explorer, safari, mozilla etc. handle errors which makes it doubly hard ot pin down...one works even w/ error type a, the others each do something different with error - e.g. ignore a row in a table vs ignore CSS refs in the row...etc
well you know how it goes.
...getting back into it.
Forgot how finicky it is - I mean all languages are - but html just does some plain wierd stuff.
Using dreamerweaver and in my includes of includes of includes...etc had let dreamweaver generate the basic page...no big deal but I had done this
<php?
blah blah blah
?>
</body>
</html>
on one of the includes and voila there are ther errant tags.
The finckyness also pops in the way netscape, explorer, safari, mozilla etc. handle errors which makes it doubly hard ot pin down...one works even w/ error type a, the others each do something different with error - e.g. ignore a row in a table vs ignore CSS refs in the row...etc
well you know how it goes.