Create a static website template framework using PHP (1) _ PHP Tutorial-php Tutorial

Source: Internet
Author: User
Use PHP to create a static website template framework (1 ). Templates can improve the website structure. This article describes how to use a new function and template class of PHP4 to skillfully control the page layout template in a website composed of a large number of static HTML pages. This article describes how to use a new function and template class of PHP 4 to skillfully control page layout in a website composed of a large number of static HTML pages.



Outline:

==========================================

Separation of functions and layout


Avoid repeated page elements


Static website template framework

==========================================




Separation of functions and layout


First, let's take a look at the two main purposes of the application template:





Separation of functions (PHP) and layout (HTML)


Avoid repeated page elements



The first purpose is to talk the most about it. it assumes that a group of programmers write PHP scripts used to generate page content, at the same time, another group of designers designed HTML and graphics to control the final appearance of the page. The basic idea of separation of functions and layout is to enable the two groups to write and use independent files: programmers only need to care about files that only contain PHP code, the page designer can design the page layout with the most familiar visual editor without worrying about damaging any PHP code embedded into the page.


If you have read several tutorials on PHP templates, you should have understood the working mechanism of the template. Consider a simple page: the top of the page is the page header, the left is the navigation bar, and the rest is the content area. Such websites can have the following template files:





Template example



{HEADER}
{LEFTNAV} {CONTENT}








Foo

Bar




We can see how the page is constructed by these templates: the main template controls the layout of the entire page; the header template and leftnav Template control the public elements of the page. The identifier in the braces "{}" is a content placeholder. The main advantage of using a template is that the interface designer can edit these files as needed, such as setting fonts, changing colors and graphics, or completely changing the page layout. The interface designer can use any common HTML editor or visualization tool to edit these pages, because these files only contain HTML code, without any PHP code.

Bytes. This article explains how to use a new function and template class of PHP 4 to control the page layout in a website composed of a large number of static HTML pages...

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.