New to php, I have always been using c # to implement the c # master page in php. net website. I encountered a problem when I first started learning php. could you help me to see how to solve it?
In the previous. net small web page system, the master page has a region dedicated to displaying the user name and ip address after login.
But because php does not have a master page, I want to write a general layout of a page (hereinafter referred to as master. php), include in other pages is equivalent to implementing the "master page" function, but encountered the following problems:
Since the master. php only writes the layout, how should the content to be displayed on different pages be put into the master page?
For example, in c #, the master page has asp: ContentPlaceHolder.
And I am in the master. write the layout in php. all the controls written on the new page are in the master. outside the php area (the display is messy, because the control is not placed in the correct position at all). how can I solve this problem?
Or is there any more common and better way to achieve this effect? Thank you!
Reply to discussion (solution)
Either use the inheritance in the framework, or implement the inheritance function by yourself, or you can separate the layout and include it with include.
Consider using the smarty template.
Use include, or refer to TP to have a template inheritance (no template inheritance is used)