Forum Moderators: coopster & phranque

Message Too Old, No Replies

.php to .html

What's the advantage?

         

lorax

2:31 pm on May 20, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I've been thinking about implementing both PHP and XHTML on a site I'm building right now. The reason I want PHP is for dynamic content and scripting and the reason I want XHTML is to create lighter pages with less junk for the spider to crawl through before it finds the content.

Q1: I'm not clear about what DTD I should use - the XHTML Transitional?

Q2: Should I convert the php files to html and if so why?

Q3: If I should convert the files to .html then is using mod_rewrite the only/best method?

I hope this makes sense. I feel like there's a ton of stuff I don't know so I'm reading through W3C's docs on XHTML and researching questions as I go. If you think I'm off-track with combining PHP and XHTML then I'd be happy to hear your alternative(s):) or any tips.

Nick_W

2:51 pm on May 20, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Q1: I'm not clear about what DTD I should use - the XHTML Transitional

Depends on how strict you want to be. If you plan on using tables for layout then you'll be needing to specify image sizes in your <img> tags so that the tables render quicker. So go with the transitional as it allows these attributes.

If you plan on using css for layout, which is by far the 'cleaner' option then the strict dtd is really not half so intimidating or difficult as it sounds. In fact, be brave and go for the xhtml 1.1 dtd which is even better!

Q2: Should I convert the php files to html and if so why?

No, you misunderstand ;) It doesn't matter what extension your files has so long as your web server understands them. It is the <!DOCTYPE> and dtd etc that determines all of that kind of stuff. All my pages are .php

Q3: If I should convert the files to .html then is using mod_rewrite the only/best method?

Don't worry about it. I'll sticky you an article I wrote on xhtml, it's a little dated but may well point you in the right direction.

Good luck!

Nick

lorax

3:15 pm on May 20, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Hey Nick_W,
Thanks for the info (and the article!). So I take it I'm not off my rocker for combining php & xhtml which is a relief.

"If you plan on using css for layout, which is by far the 'cleaner' option then the strict dtd is really not half so intimidating or difficult as it sounds. In fact, be brave and go for the xhtml 1.1 dtd which is even better!" (btw - how do you create those neat little tables?)

I do plan on using tables but only because I'm not experienced with making my CSS layouts - in fact I'm worried that I'll get bogged down with making them cross browser compatable. But, if I understand you correctly, the advantage of the Strict DTD is speed? Is there something else I lose out on by going with Transitional?

Nick_W

3:32 pm on May 20, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



No not a speed thing, sure there is less code if you choose a css layout but the actual dtd will make no difference in itself. Go with the transitional, it'll give you a good introduction.

Just make sure you validate your code.

The little tables are done using the 'style codes' link on the left of your post. You can do bulleted lists and allsorts ;)

Nick

lorax

4:02 pm on May 20, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Hey Nick_W,
One more question on combining PHP and XHTML. The first line for defining the document <?xml version="1.0" encoding="UTF-8"?> causes a problem when the page is parsed. How do you get around this?

lorax

4:21 pm on May 20, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Nevermind - I figured it out. Thanks again for your help.

Gregg

Nick_W

4:47 pm on May 20, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



No worries, just make sure that the <!DOCTYPE> is before the xml declaration othewise you'll trigger ie to run in quirks mode.

Nick