woolyg Posted November 20, 2007 Share Posted November 20, 2007 Hi all, I thought I'd post this as a discussion/commentary rather than a help request, as I'm just getting in to learning about it. I've been piecing together PHP and CSS of late, coming from a dumdum HTML background, and have had an idea for a site that I think will work pretty well, so I am working on a good, XHTML/CSS compliant PHP site that can be viewed & used without issue across all browsers & platforms. Have any of you had any major headaches in successfully validating PHP-infused XHTML/CSS pages? Is it actually possible to do? - Am I barking up the wrong tree..? Are there any major pitfalls to look out for? All discussion / comments are much appreciated. Cheers, Quote Link to comment https://forums.phpfreaks.com/topic/78137-php-and-xhtmlcss-compliance/ Share on other sites More sharing options...
obsidian Posted November 20, 2007 Share Posted November 20, 2007 It is certainly possible. Keep in mind that by the time the validation takes place, it is only what the browser sees that is validated, so none of your PHP exists in the code any longer. You are simply validated the resulting markup. I strive for every page I write to be at the minimum XHTML compliant. You can double check my main page on a current site I'm putting together at http://pts.guahanweb.com if you'd like. Last I checked, my markup and CSS validates there. Quote Link to comment https://forums.phpfreaks.com/topic/78137-php-and-xhtmlcss-compliance/#findComment-395442 Share on other sites More sharing options...
woolyg Posted November 20, 2007 Author Share Posted November 20, 2007 Obsidian, Congratulations on your compliance Thats a great help - I was worried that the markup output by ECHO statements and various PHP jiggerypokery might affect the compliance, but now I know that careful construction will aid validation. If I use includes on my page, I need to ensure they are validated also, is that correct? I am trying to bring in modules to each page so that sections can be coded separately.. WoolyG Quote Link to comment https://forums.phpfreaks.com/topic/78137-php-and-xhtmlcss-compliance/#findComment-395501 Share on other sites More sharing options...
PFMaBiSmAd Posted November 21, 2007 Share Posted November 21, 2007 PHP outputs (X)HTML/CSS/Javascript content when the page is requested. The overall page is what must be valid and is what is validated. Individual include files are not validated, because they don't have meaning until they have been included into a page. In fact, because of the doctype/html/head/body structure of a web page, include files would not validate because each of them would not necessarily contain all the structural elements required to make a whole web page (depending on how you are using includes.) Quote Link to comment https://forums.phpfreaks.com/topic/78137-php-and-xhtmlcss-compliance/#findComment-395522 Share on other sites More sharing options...
AndyB Posted November 21, 2007 Share Posted November 21, 2007 one caveat is that ampersands will cause trouble (often present in links in php-generated scripts) with validation. Solution is as simple as defining the separator_output as & Quote Link to comment https://forums.phpfreaks.com/topic/78137-php-and-xhtmlcss-compliance/#findComment-395596 Share on other sites More sharing options...
woolyg Posted November 21, 2007 Author Share Posted November 21, 2007 AndyB, How do you mean 'defining the separator_output as &' ? Thanks Quote Link to comment https://forums.phpfreaks.com/topic/78137-php-and-xhtmlcss-compliance/#findComment-395603 Share on other sites More sharing options...
Daniel0 Posted November 21, 2007 Share Posted November 21, 2007 AndyB, How do you mean 'defining the separator_output as &' ? Thanks He's talking about a setting in php.ini which you can change. Quote Link to comment https://forums.phpfreaks.com/topic/78137-php-and-xhtmlcss-compliance/#findComment-395612 Share on other sites More sharing options...
woolyg Posted November 21, 2007 Author Share Posted November 21, 2007 So if I have arg_separator.output = "&" ..in my php.ini file, and continue the structure my links as: <a href='date.php?day=$day&month=$month... Then the validator will accept the link as valid? Quote Link to comment https://forums.phpfreaks.com/topic/78137-php-and-xhtmlcss-compliance/#findComment-395621 Share on other sites More sharing options...
Daniel0 Posted November 21, 2007 Share Posted November 21, 2007 No. It's still malformed. You must convert them to HTML entities (i.e. convert them to &). Quote Link to comment https://forums.phpfreaks.com/topic/78137-php-and-xhtmlcss-compliance/#findComment-395705 Share on other sites More sharing options...
woolyg Posted November 21, 2007 Author Share Posted November 21, 2007 Ahh... ok:) Thanks for that! Woolyg Quote Link to comment https://forums.phpfreaks.com/topic/78137-php-and-xhtmlcss-compliance/#findComment-395713 Share on other sites More sharing options...
obsidian Posted November 21, 2007 Share Posted November 21, 2007 Ahh... ok:) Thanks for that! Woolyg Where the problem lies is that some servers will attach your PHPSESSID to the end of a query string, and it will use the arg_separator.output definition for tacking it onto the end. So, if you don't put the & as the output, you'll may a straight &PHPSESSID=[whatever] tacked on to the end of every link that will cause your page not to validate. Quote Link to comment https://forums.phpfreaks.com/topic/78137-php-and-xhtmlcss-compliance/#findComment-395836 Share on other sites More sharing options...
woolyg Posted November 21, 2007 Author Share Posted November 21, 2007 Yeah - I've seen that alright - but the server I'm using seems to only append &PHPSESSID=[whatever] to a URL if I haven't specified the exact url yet, and left it blank (eg. <a href=''>Link</a>). In formed links, it seems ok - but I'll definitely keep an eye out for it. Can any of you guys think of any other problems with XHTML validation? This is all helping muchly. Quote Link to comment https://forums.phpfreaks.com/topic/78137-php-and-xhtmlcss-compliance/#findComment-396183 Share on other sites More sharing options...
djbuddhi Posted March 11, 2008 Share Posted March 11, 2008 where is the sajax2.php Quote Link to comment https://forums.phpfreaks.com/topic/78137-php-and-xhtmlcss-compliance/#findComment-489170 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.