开发者

Is it a good idea to make a PHP website using only DOM? [closed]

开发者 https://www.devze.com 2023-02-23 02:49 出处:网络
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical andcannot be reasonably answered in its current form. For help clari
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 11 years ago.

Good morning,

I'm making a website in PHP, the "classic way" (mixing html and php). However as the website grows, the code gets ugly. So I was wondering if making the whole website with DOM is a good idea. DOM produces, I think, cleaner code, allow faster modifications in the code . etc.

"DOM" refers to the functions you can find here : http://php.net/manual/en/book.dom.php (开发者_开发知识库createElement, getElementById ...)

Is it a good idea to use only DOM ? Or is it a crazy idea ?

Thanks.


No, both ideas are bad. Mixing code and HTML is just terrible. Trying to build whole HTML using DOM is way too inefficient. The way to go is to separate logic and presentation. Later should be done using templates.

Use web framework implementing MVC pattern. There are quite a few of them for PHP.

0

精彩评论

暂无评论...
验证码 换一张
取 消