Template framework for static web site with PHP _php tutorial

Source: Internet
Author: User
Templates can improve the structure of your site. This article explains how to use templates to control page layouts in a Web site composed of a large number of static HTML pages, using a new feature and template class for PHP 4.
Outline:
===================================
Separating features and layouts
Avoid duplicate page elements
Template framework for static web sites
===================================

Separating features and layouts
First, let's look at the two main purposes of applying a template:

Detach function (PHP) and layout (HTML)
Avoid duplicate page elements
The first is to talk about the most, and it assumes that a group of programmers write PHP scripts to generate page content, while another group of designers design HTML and graphics to control the final appearance of the page. The basic idea of separating functions and layouts is to enable the two groups of people to write and use separate sets of files: programmers only care about files that contain only PHP code, don't care about the appearance of the page, and page designers can design the page layout with their most familiar visual editor. No need to worry about breaking any PHP code embedded in the page.
If you've ever seen a few tutorials on PHP templates, you should already understand how templates work. Consider a simple page detail: The top of the page is the page header, the left side is the navigation bar, and the rest is the content area. This site can have the following template files:


<title>Template examples</title>

{HEADER}
{LeftNav} {CONTENT}





Foo

Bar

You can see how the pages are constructed from these templates: The main template controls the layout of the entire page, and the header template and the LeftNav template control the common elements of the page. The identifier inside the curly brace "{}" is a content placeholder. The main benefit of using templates is that the interface designer can edit the files as they wish, such as setting fonts, modifying colors and graphics, or completely changing the layout of the page. Interface designers can edit these pages with any ordinary HTML editor or visualizer, because they contain only HTML code and no PHP code.

http://www.bkjia.com/PHPjc/531769.html www.bkjia.com true http://www.bkjia.com/PHPjc/531769.html techarticle templates can improve the structure of your site. This article explains how to use templates to control page layouts in a Web site composed of a large number of static HTML pages, using a new feature and template class for PHP 4 .

  • 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.