homepage Welcome to WebmasterWorld Guest from 54.226.43.155
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
XHTML and PHP
Knowles




msg:1315363
 1:10 am on Jul 18, 2002 (gmt 0)

I need a little help, I am working on a site that will have PHP and XHHTML both.

I am having a problem including this line though:
<?xml version="1.0" encoding="UTF-8"?>

Any ideas how to pharse this? Or am I just doing it wrong?

 

toadhall




msg:1315364
 4:49 am on Jul 18, 2002 (gmt 0)

Knowles, have a look at the NYPL styleguide [nypl.org] for XHTML doc type and character encoding.

"Note: many XHTML pages begin with an optional XML prologue ( <?xml> ) that precedes the DOCTYPE and namespace declarations. Unfortunately, this XML prologue causes problems in many browsers..."

Nick_W




msg:1315365
 6:30 am on Jul 18, 2002 (gmt 0)

No, I beleive Knowlse is getting a parse error right? Here ya go....

print("<?xml version=\"1.0\" encoding=\"UTF-8\"?>";

Nick

Knowles




msg:1315366
 1:01 pm on Jul 18, 2002 (gmt 0)

Thank you Nick Ill try it when I get home, I think I tried echo'in it but that still gave an error.

toadhall, I know of the errors caused my user base is newer browsers, I have tested all my websites with that encoding and it works on all mine (IE Opera Mozilla).

toadhall




msg:1315367
 4:33 pm on Jul 18, 2002 (gmt 0)

Best to encode the angle brackets:

print("&lt;?xml version=\"1.0\" encoding=\"UTF-8\"?&gt;");

Knowles




msg:1315368
 4:49 pm on Jul 18, 2002 (gmt 0)

Good idea toadhall, thanks for the suggestion!

ergophobe




msg:1315369
 6:44 pm on Jul 18, 2002 (gmt 0)

Knowles,

I use PHP and XHTML 1.0 strict. I do this:

<?php echo '<?xml version="1.0" encoding="iso-8859-1"?>'; ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">


print("&lt;?xml version=\"1.0\" encoding=\"UTF-8\"?&gt;");

Toadhall is wrong about this. You *want* the brackets. If you do not use bracks, but instead use &lt; it will not recognize your xml tag as a tag, but as text and you don't want that.

Incidentally, I had trouble with Unicode and validation (because I don't have an editor that doesn't add the .... what is it? BMsomething and W3C chokes on validation. What have you done?

Tom

Knowles




msg:1315370
 11:31 pm on Jul 18, 2002 (gmt 0)

I have been editing with homesite 5.01 its been giving me no problems validating my XHMTL code, check the link in my interests (soon as I add it)

<added>Its not PHP but I havent gotten far enough in development to do that</added>

<addeded> WOO HOO Mayed Preferred Member </addeded>

Knowles




msg:1315371
 12:19 am on Jul 19, 2002 (gmt 0)


Parse error: parse error in localhostinfo/site.php on line 1

Doesnt matter which way I try echo or print, ' or " it still comes out with a parse error.

mavherick




msg:1315372
 1:58 am on Jul 19, 2002 (gmt 0)

Seems like you got it working. Which way did you code it?

ergophobe




msg:1315373
 2:47 am on Jul 19, 2002 (gmt 0)

Knowles,

I don't understand. The site you listed looks perfect and you say the problem is not with your XHTML.

Then you say it isn't with PHP either, but you get a parse error, so that can only be PHP.

The PHP code that I posted works fine and generates valid XHTML. If you are getting a parse error, it's coming from somewhere else.

Try creating "skeleton" pages that just call stub functions (routines that just return without doing anything). Get rid of complexity until you locate the problem. If you still can't figure it out, post the code.

Tom

ergophobe




msg:1315374
 2:50 am on Jul 19, 2002 (gmt 0)

Can you post the first 5 lines of site.php?

If I had to guess, upon thinking about it, I bet you're missing a semicolon after line 1 or something like that.

Tom

Knowles




msg:1315375
 11:52 am on Jul 19, 2002 (gmt 0)

Sorry for the confusion, the one I put in intrests is Pure XHTML no PHP. I am working locally to turn it to PHP.
First 5 lines:

<?PHP print("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"; ?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" >
<head>

Also tried:
<?PHP echo '<?xml version="1.0" encoding="UTF-8"?>'; ?>

The reason for the URL in Profile was in reference to this
Incidentally, I had trouble with Unicode and validation (because I don't have an editor that doesn't add the .... what is it? BMsomething and W3C chokes on validation. What have you done?
That was an example of Unicode and validated code.

ergophobe




msg:1315376
 7:18 pm on Jul 19, 2002 (gmt 0)


<?PHP print("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"; ?>

1. Your parentheses don't match.

2. I'm not certain, but the standard is <?php. I'm not sure whether or not uppercase is allowed, though it would take two seconds to test (but I'm too lazy).


Also tried
<?PHP echo '<?xml version="1.0" encoding="UTF-8"?>'; ?>

That is exactly what I have, except for lowercase tags for invoking php, and it validates.

Tom

Knowles




msg:1315377
 8:08 pm on Jul 19, 2002 (gmt 0)

Thank you for the catch on the missed quote. DOH! And now on the server the echo way is working but it wasnt on localhost, Ill have to play with it this weekend to figure out whats wrong with me!

Thanks for yalls help.

ergophobe




msg:1315378
 9:55 pm on Jul 19, 2002 (gmt 0)

You should get an editor that has decent pair matching for [{('".

Syntax highlighting, code completion, all that sort of stuff is just eye candy. It can make things easier to read, but it doesn't help much in the end. Brace matching is such a help when your eyes just won't work. There are a lot of editors that support it.

- I've once had emacs set up for it (just parens for Scheme programming)

- I mostly use HAPedit, which does it pretty nicely, but I'm sort of biased there because I'm the one who made the feature request and so it's sort of done to the way I like it.

- I think TextPad, EditPad and UltraEdit can all do this, but I don't use them so I don't know.

Cheers,

Tom

Knowles




msg:1315379
 11:14 pm on Jul 19, 2002 (gmt 0)

Yes I have played with some in the past that had this function and it is very helpful, I am not sure it would have fixed the issue for me though I was not even looking at that! DUH!

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
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