Liquid Fire Posted October 30, 2007 Share Posted October 30, 2007 If a framework provided a class that would produce xhtml code for you would you use it or just code the xhtml yourself? Quote Link to comment Share on other sites More sharing options...
trq Posted October 30, 2007 Share Posted October 30, 2007 A class that outputted xhtml would just tie the bussiness logic to the output. The whole point of a framework should be the reverse. Quote Link to comment Share on other sites More sharing options...
Jenk Posted October 30, 2007 Share Posted October 30, 2007 A class that outputted xhtml would just tie the bussiness logic to the output. The whole point of a framework should be the reverse. er.. what? Having PHP generate valid, semantic (X)HTML for you would be the ideal framework. Quote Link to comment Share on other sites More sharing options...
Liquid Fire Posted October 30, 2007 Author Share Posted October 30, 2007 A class that outputted xhtml would just tie the bussiness logic to the output. The whole point of a framework should be the reverse.  Even tho i am starting to think that idea of this class is over board for general tags(something like tables is different) i think your think of something else. The point of a PHP framework is not to separate business logic from the output, the is what a template system is for. I personally do not like template system because you can never fully seperate logic for the output(almost all template system have ways to do foreach and if and etc... because they are needed in some cases). I feel if i am going to have to use that logic in the template i migth has well use php, it is not that much harder to code the logic at the top of a php file and then the output at the bottom. Quote Link to comment Share on other sites More sharing options...
trq Posted October 30, 2007 Share Posted October 30, 2007 A class that outputted xhtml would just tie the bussiness logic to the output. The whole point of a framework should be the reverse. er.. what? Having PHP generate valid, semantic (X)HTML for you would be the ideal framework. Â Not in my opinion. This would tie the bussiness logic to the output, not good. A better approuch is the tried and tested MVC. Where your output is seperate from your logic. Quote Link to comment Share on other sites More sharing options...
trq Posted October 30, 2007 Share Posted October 30, 2007 I suppose I should elaberate a little. Â If a framework provided a class that would produce xhtml code for you would you use it or just code the xhtml yourself? Â I guess what I should be saying is that this would depend upon where abouts within the framework this class was used. If you where to impliment it within the bussiness logic it would be detrimental. Â Imagine youve just build a huge site using such a framework. Your client comes back a few months later and asks you to build the entire site into a Flash UI. He still wants the old one kept for users without Flash enabled though. Â If your frameworks logic outputs nicely formatted html your screwed. Flash requires xml. Using your framework you now have to go into your logic and rewrite it all for Flash. Â If on the other hand the logic of your framework outputted the raw data, you could simply wrap this raw data in xml. All you would need do is create a new view marked up with xml and let the controller know to use that view when the request is being made from Flash. Â Having said all that. A class that outputs valid xhtml could still come in handy in the view stage of an mvc framework. And in fact alot of these frameworks do have classes or functions specifically for such a purpose. Quote Link to comment Share on other sites More sharing options...
Liquid Fire Posted October 30, 2007 Author Share Posted October 30, 2007 http://www.phpfreaks.com/forums/index.php/topic,165712.0.html  this is kinda a reply to your last comment. Quote Link to comment Share on other sites More sharing options...
Jenk Posted October 31, 2007 Share Posted October 31, 2007 A class that outputted xhtml would just tie the bussiness logic to the output. The whole point of a framework should be the reverse. er.. what? Having PHP generate valid, semantic (X)HTML for you would be the ideal framework.  Not in my opinion. This would tie the bussiness logic to the output, not good. A better approuch is the tried and tested MVC. Where your output is seperate from your logic. I guess you don't fully understand MVC, or OOP. It is very easily possible to have an object for generating (X)HTML, completely separate from your model. Using flash instead would be of non-issue, if you have separated model from view. Separating does not incur use of different languages. How do you get values from PHP to HTML pages, without using PHP to at least parse template files?  Instead of: <a href="<?php echo $link ?>"><?php echo $title ?></a> why not: $html->createAnchor($link, $title); when the create anchor method looks like: public function createAnchor ($link, $title) {  $this->_output .= '<a href="' . $this->_escape($link) . '">' . $this->_escape($title) . '</a>'; } ? Quote Link to comment Share on other sites More sharing options...
trq Posted October 31, 2007 Share Posted October 31, 2007 As I said in my last post.... Â I guess what I should be saying is that this would depend upon where abouts within the framework this class was used. If you where to impliment it within the bussiness logic it would be detrimental. Â A class that outputs valid xhtml could still come in handy in the view stage of an mvc framework. Quote Link to comment Share on other sites More sharing options...
Jenk Posted October 31, 2007 Share Posted October 31, 2007 That's lots of back pedaling from what you said here: Not in my opinion. This would tie the bussiness logic to the output, not good. A better approuch is the tried and tested MVC. Where your output is seperate from your logic. Quote Link to comment Share on other sites More sharing options...
trq Posted October 31, 2007 Share Posted October 31, 2007 Yeah, I guess I misread the original post a little, so what? Quote Link to comment Share on other sites More sharing options...
Liquid Fire Posted October 31, 2007 Author Share Posted October 31, 2007 That's lots of back pedaling from what you said here: Not in my opinion. This would tie the bussiness logic to the output, not good. A better approuch is the tried and tested MVC. Where your output is seperate from your logic. i don't why you are his case when he did take back some of what he said, what else do you want from him? Quote Link to comment Share on other sites More sharing options...
Daniel0 Posted October 31, 2007 Share Posted October 31, 2007 I'll use whatever eases my work as long as it doesn't have any significant effect on performance (which an HTML class shouldn't have unless it's very poorly written). Quote Link to comment 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.