The way i normally do php is, i have my basic HTML page, then i add php to it.
I want to make it more efficient, and have pages with just php, and include the template the way phpbb does.
but i am not sure how it works. help please?
Printable View
The way i normally do php is, i have my basic HTML page, then i add php to it.
I want to make it more efficient, and have pages with just php, and include the template the way phpbb does.
but i am not sure how it works. help please?
There are lots of ways:
At the simplest level, you could simply put your mixed HTML and PHP into a template file and include that from your PHP-only processing file.
At a complex level, you could have a template file written in some kind of template processing language (either PHP itself, or an XML-based language) which is then processed by a template object which is instantiated and called from your processing file.
Don't go nuts trying to make everything into classes. PHP is a scripting language with some object-oriented capabilities; it's not an object-oriented platform. Generally, the fewer things you need to include for a single request, the better.
Of course, some types of request are performance-intensive, and some are not. You need to decide for yourself which pages are most likely to be hit often and streamline the design of those.
ok cool thanks.
I will look into this later then, when i have more advanced pages. :)
thanks