PHP xhtml

demonhale's picture

He has: 3,278 posts

Joined: May 2005

I was wondering if any of you guys/gals experienced problems when making a PHP page with one general PHP, two

<?php
include "code1.php";
?>
, an swf object wherein embed is not supported by xhtml DTD's? Using object will let it show in IE and OPera but not in FF?

Main Concern however is validating multiple PHP includes, with individual html head, body, standard tags...

Your thoughts on this please...

Busy's picture

He has: 6,151 posts

Joined: May 2001

PHP is server side, Validating is client side

you are only validating the output of the included files so makes no difference.
Is just as easy to validate a 'on the fly' site as it is a static site.

As for the embed/object, get it to validate then use both.
While validation is worth a lot it isn't always the most useful thing, example target=, while this isn't XHTML friendly it is easier to use than javascript etc (I don't personaly like opening new windows but needed an example lol)

JeevesBond's picture

He has: 3,956 posts

Joined: Jun 2002

Good points Busy. Also if you want a method for validation-friendly Flash embedding look up the ALA Article: http://www.alistapart.com/articles/flashsatay

I've used this in the past and it works a treat. Smiling

a Padded Cell our articles site!

Roo's picture

She has: 840 posts

Joined: Apr 1999

I think I got this from ALA...I'm using it on a site of mine and it validates:

Replace ??? with your movie dimentions and nameofmovie with your file name.

Roo

demonhale's picture

He has: 3,278 posts

Joined: May 2005

Yeah object tag does validate I said, but then it quirks up on some old versions of FF and other browsers...

Mainly the concern would be if I code different PHP files then use include tags on another PHP file which will contain these different PHP files, then their would be some validation problems, also with the active URL and all... Jus a thought...

Roo's picture

She has: 840 posts

Joined: Apr 1999

Quote: but then it quirks up on some old versions of FF and other browsers...

How old are we talking here?

I test in seven browsers, and there are no problems with it in any of these:
Firefox, Mozilla Suite, Netscape 7, Netscape 8, Opera 6, Opera 8, IE6.

Roo

demonhale's picture

He has: 3,278 posts

Joined: May 2005

moz 1.5 i think is an example, but then again maybe it was a conflict...

Busy's picture

He has: 6,151 posts

Joined: May 2001

Can you give us a url that we can see the validation error on?

demonhale's picture

He has: 3,278 posts

Joined: May 2005

I figured it out, thanks anyway, I guess all I was asking were opinions on multiple PHP includes, the solution would be on the other PHP files you wish to include inside a another PHP file, you should remove all duplicate html tags that would be displayed. Removing tags like body and html... Treat it like its not an individual page the way an iframe is done...

Busy's picture

He has: 6,151 posts

Joined: May 2001

I have several sites where pages are done like so:

<?php
/*page variables */
$var1 = "something";
$var2 = "something else";
.....
include
"header.php";
include
"layout_top.php";
include
"content.php";
include
"layout_lower.php";
include
"footer.php";
?>

No actual content is written in the page and pages like header contains the head section, things like DOC tag, meta tags, title, css includes ... as well as the tag.
the footer usually just contains the bottoms links (sometimes) but mostly just as the includes are added content, not new html files.
The php pages could be done like so:

....

<?php
include "stuff.php";
...
?>

this time the includes dont contain any structal html. All depends how much you pull from the database or how much of a template the layout is.

demonhale's picture

He has: 3,278 posts

Joined: May 2005

Yeah thats exactly right, thats what I figured out later coz I was coding the PHP files as individual pages which functions on their own, then I decided to use all of them inside a single php page, so thats how I figured out that structuring it more so is not really necessary if youve done it on one holder...

Anyways another thing that doesnt validate are PHP sessions... Oh Well...

Busy's picture

He has: 6,151 posts

Joined: May 2001

Nope, sessions wont because of the & symbol. If you are validating from a web site (uploaded site), click on 2 or 3 other pages then back to the page you want to validate as this will clear the session, or you can have an option to not start the session, include the session stuff in a seperate file (as it should be before any output) and have something like: $test_mode = 'yeah'; /* or nah */ if ($test_mode == 'yeah'){ don't start session }else{ do the session stuff } kinda thing, this way if you forget to switch back it is only a simple value change to a single file.

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.