Does php have a master page similar to. net?

Source: Internet
Author: User
Does php have a master page similar to. net,
The page header (navigation bar) and footer (copyright information) of all pages on the website are the same, and the page header and footer of all pages in a file are changed automatically.
I didn't understand php at the beginning. I hope to explain it in detail. thank you!


Reply to discussion (solution)

Write the header and footer of the page into two public files. other files only need to be included.

Write your navigation page and footer as a php page or tpl template page

Then you can include the required page.

For example, include ('menu. php'); menu. php is your navigation page

Write your navigation page and footer as a php page or tpl template page

Then you can include the required page.

For example, include ('menu. php'); menu. php is your navigation page
Written as a php page, menu. php (Template page), it is necessary to use Smarty to separate the code and html, and then reference menu. php on other pages. You can also use menu.html (html navigation page) directly on other pages ).
The tpl Template page does not know. it is better to solve the problem by using two sections of code.

By the way, we recommend several lightweight code editors, so zend studio will not recommend them,
Vim was very powerful, but I was a little dizzy. Sublime Text 2 and Notepad ++ are very useful. Are there any lightweight code editors that are useful?

The code editor is usually used to EditPlus on win.

It's easy to make vi simple... if vim is dizzy, don't try vi.
Notepad ++.
Of course, I have to recommend phpstorm for ide.

By the way, we recommend several lightweight code editors, so zend studio will not recommend them,
Vim was very powerful, but I was a little dizzy. Sublime Text 2 and Notepad ++ are very useful. Are there any lightweight code editors that are useful?

Don't talk about IDE and code editor.
Help me solve the following problem first
????????????????????????
Reference the reply on the second floor:

Write your navigation page and footer as a php page or tpl template page

Then you can include the required page.

For example, include ('menu. php'); menu. php is your navigation page
????????????????????????
Written as a php page, menu. php (Template page), it is necessary to use Smarty to separate the code and html, and then reference menu. php on other pages. You can also use menu.html (html navigation page) directly on other pages ).
The tpl Template page does not know. it is better to solve the problem by using two sections of code.

My personal habits are to include a page directly. There is no need for Smarty or html separation. In fact, it depends on how complicated your content is. if you just navigate some copyright information, isn't it more complicated?
Of course, you can simply use html, unless you do not want to make those who are not logged in can't even see the navigation.

Do you need code? In this case, you only need to include this file.

Include

Forgive me or master

= Php still does not have a master page

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.