Apr
2008
17
 posted at 10:55 pm filed under: PHP
2 votes

Sometimes you just get a brain deadlock on the simplist thing. A few weeks ago I was converting some pages on a site to xhtml 1.0 strict. As you probably know, this requires each page to start with the following xml declaration:

< ?xml version="1.0" encoding="utf-8" ?>

No problem right? Wrong. That decleration is similar to the start of a php decleration:

< ?php

Needless to say it creates an error when you try to load the page. That’s where things went nuts and I was drawing a blank. “This should be easy to do” I kept saying to myself. “What am I missing”. Geesh, how stupid did I feel when it finally hit me. Here’s all you need to do. Put the following php command on the first line of the document:

echo '< ?xml version=\"1.0\" encoding=\"utf-8\"?>\n';

Just figured I’d post this in case someone else had a brain freeze as bad as the one I had.

12 users commented in " xml decleration in php "

Follow-up comment rss or Leave a Trackback
May 27th, 2009 at 11:37 pm

Это прямо в точку!!! По другому и не скажешь! :)

June 13th, 2009 at 1:09 pm

Спасибо, пост действительно грамотно написан и по делу, есть что почерпнуть.

June 22nd, 2009 at 4:21 pm
Becham said:

Ну естественно, действительно так оно и есть. :)

July 4th, 2009 at 6:49 pm

Да таков наш современный мир и боюсь с этим ни чего нельзя поделать:)

August 20th, 2009 at 5:30 pm
лякa said:

На Ваш блог знакомый в аську ссылку кинул. Оказалось ,что не зря :) Понравилось. Тепрь все время читать буду :)

August 24th, 2009 at 6:07 am

Замечательно! Все бы так писали :)

September 26th, 2009 at 8:26 am
Deripet said:

Fully agree with you, about a week ago wrote about the same in his blog!

October 21st, 2009 at 1:07 am

Текст оставил сложное, даже в какой-то степени неоднозначное, впечатление… Даже не знаю, что сказать… Нужно время, чтобы обдумать прочитанное.

November 4th, 2009 at 7:40 am
пyпo said:

Достаточно спорно, но как вариант имеет право на существование

December 13th, 2009 at 3:24 pm

Thank you for answering all the questions in your post. In fact, learned a lot. That’s only until the end and did not understand what and where.

January 14th, 2010 at 5:13 pm

Данный пост действительно помог мне принять очень нужное для меня решение. За это автору отдельное спасибо! С большим нетерпением жду от Вас новых сообщений!

February 19th, 2010 at 7:11 pm
coatprear said:

Возможно ли оценить вероятность правильности теории вероятности?

Leave A Reply

 Username (*required)

 Email Address (*private)

 Website (*optional)

Ramblings of a Deluded Mind
Loading...
Login
Register

A password will be mailed to you
Retrieve password

A confirmation mail will be sent to your e-mail address
AddThis Feed Button AddThis Social Bookmark Button
Contact Me
  1. (required)
  2. (valid email required)
  3. (required)
 

cforms contact form by delicious:days