Jump to content

Recommended Posts

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.

Link to comment
https://forums.phpfreaks.com/topic/75300-html-generating-class/#findComment-381068
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/75300-html-generating-class/#findComment-381134
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/75300-html-generating-class/#findComment-381204
Share on other sites

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>';
}

?

Link to comment
https://forums.phpfreaks.com/topic/75300-html-generating-class/#findComment-381777
Share on other sites

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.
Link to comment
https://forums.phpfreaks.com/topic/75300-html-generating-class/#findComment-381849
Share on other sites

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?

Link to comment
https://forums.phpfreaks.com/topic/75300-html-generating-class/#findComment-382306
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.