Jump to content

Use a template for all pages


silent_sufferer

Recommended Posts

Hi im still rather new to css but here is what I would like to do.On a webpage such as on the internet they all have a layout which every page follows and that's what I'm trying to achive.I started a webpage a few years ago that I just recently wanted to redo but the problem with it is that it contains so many pages and to go too each page to change the layout is rather tiresome so what I was thinking is too take the following code(Is the raw data of my page that every page contains will refine it) and use it as the layout for every page using css

<html><body><body background="Images/wallpaper.jpg"><p><table border="0" width="100%"><tr><td><font color="blue">Version: v2.04</font></td><td align="right"><font color="blue">Designed by</font></td></tr><tr><td></td><td align="right"><font color="blue">SILENT SUFFERER</font></td></tr></table></p><a href="http://www.freeonlinegames.com/"><img border="0" src="Images/freeonlinegames_com-logo.jpg" align="left" width="42" height="32" /></a><a href="http://www.google.co.za/"><img border="0" src="Images/google_logo.jpg" align="right" width="42" height="32" /></a><br /><br /><a href="http://armorgames.com/"><img border="0" src="Images/armor-logo.jpg" align="right" width="102" height="32" /></a><a href="http://www.hackedarcadegames.com/"><img border="0" src="Images/HACKED ARCADE GAMES.jpg" align="left" width="102" height="32" /></a><br /><br /><br /><br /><br /><body></html>

If anyone can tell me a way so that by designing maybe one page and using it for all of the pages using css. Wish I had known about css when I started coding the page.P.S. I use notepad for my coding

Link to comment
Share on other sites

If you have many many pages of content, if not use a database with your site?

Link to comment
Share on other sites

  • 2 weeks later...

Three <body> opening tags, multiple <br />, <table> in <p> for styling purpose, inline CSS.IMO you have to redo properly every pages with external CSS files. If the pages are generated by script, you can make HTML templates and includes them in every page.I work with a PHP MVC framework and View objects have a loadTemplate($name, $data) function.A basic page look like

$this->loadTemplate('head', $data); // ($data contain canonical url, page title, css and js filenames, etc.)$this->loadTemplate('header');$this->loadTemplate('meta_navigation');$this->loadTemplate('local/navigation');?><!-- Page content --><?php$this->loadTemplate('footer');

You can use require($templatePath); instead of $this->loadTemplate($name, $data); if you haven't an OO framework.

Edited by Raspberry
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...