Does PHP have a master page that is similar to. NET?
Source: Internet
Author: User
Does PHP have a master page similar to. NET?
Title
You want the page header (navigation bar) and footer (copyright information) for all pages in the site to be the same, and the header and footer of all pages are changed automatically whenever you change a file.
Just started to learn PHP, do not understand, hope to tell the details, first thank you!
------Solution--------------------
Write the page header and footer to two common files, and the other files need to be included.
------Solution--------------------
Write your navigation page and footer as a PHP page or a TPL template page
Then the desired page contains the
such as include (' menu.php '); menu.php is your navigation page.
------Solution--------------------
Code Editor in win with the general or the habit of editplus it
------Solution--------------------
Simply to VI ... If Vim is dizzy, don't try VI.
notepad++ on the line.
Of course, I have to recommend the IDE's phpstorm.
Explore
By the way, we recommend a few lightweight code editors, Zend Studio does not recommend,
Vim heard very strong, but I used a bit dizzy, Sublime Text 2 and notepad++ very useful, in addition to these there is no better lightweight code editor?
------Solution--------------------
Brother, let's not talk about the IDE and the Code Editor.
Help me solve this problem first
————————————————————————
Reference:
Write your navigation page and footer as a PHP page or a TPL template page
Then the desired page contains the
such as include (' menu.php '); menu.php is your navigation page.
————————————————————————
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. As if it were an HTML page, you can also refer to menu.html (the HTML navigation page) directly on other pages.
TPL Template page does not know, solve, to two pieces of code better.
------Solution--------------------
For this problem with head and tail, as for my personal habits, just include a page directly. As for the use of what smarty do not HTML separation this actually depends on how complex the content you contain, if it is only a little bit of navigation of the copyright information, so it is not more complicated?
Of course, you can use HTML directly, unless you're not going to let people who aren't logged in don't even see the navigation.
Do you need code? In that case, you just include the file.
------Solution--------------------
Include
------Solution--------------------
Or a forgive or a master.
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.