Jichao
Jichao

Reputation: 41845

How to programming website with php in a modularized way?

I am developing a website that many pages share the same header/footer/sidebar/topbar.

Say I have three pages: one/index.php, second/index.php, third/index.php. They all share the same header/footer/sidebar.

The problem is where should I put the header/etc and its corresponding css file, since a piece of html code could not import css file.

What's a good way to modularize php/html page? Is there any good tutorial?

Upvotes: 0

Views: 746

Answers (2)

Bill the Lizard
Bill the Lizard

Reputation: 406135

You can use the PHP include statement to insert your header/footer/sidebar files where they need to be inserted in your other PHP pages.

Upvotes: 1

Brandon Frohbieter
Brandon Frohbieter

Reputation: 18139

Sounds like you may want a MVC framework and a template engine. Check out CodeIgniter, or TinyMVC with Smarty. Call external stylesheets with:

    <LINK href="special.css" rel="stylesheet" type="text/css">

Upvotes: 2

Related Questions