Jump to content

Sitewide layout updating


Glom

Recommended Posts

My website consists of a bunch of pages following a standard template. With css, changes to styles are done easily enough. But if I wanted to change the layout of the pages, at present, I would need to update each page individually. Is there a way to write the template so that it accepts layout information from an external source like a stylesheet so that all pages can be updated with just one edit?

Link to comment
Share on other sites

You could use a serverside language to pull in the template and then fill in the content from a databse. That way each page is pulling int he same template so any changes to the template file would be site wide.This would take a bit of planning. I can give you some pointers if you want.

Link to comment
Share on other sites

You could use a serverside language to pull in the template and then fill in the content from a databse. That way each page is pulling int he same template so any changes to the template file would be site wide.This would take a bit of planning. I can give you some pointers if you want.

Ooh. Sounds complicated. Pointers would be appreciated.
Link to comment
Share on other sites

First of all you need a database. Our table will be called PagesPageIdPageTitleText1Text2We'll keep it small to keep it simple for now.Then in your website folder we would create a templates folder. Inside the templates folder we would put templates.Templates are just the HTML/CSS that make up the layout except we would have to put in Identity Tags to let our code know where to put the text

...<div class="MainText">{TEXTBOX1}</div>...

Then in the Server Side code(SSC) we would open and read the contents of the template file (you can have .txt, .html, or whatever extension you want) in a variable. Then we would search the variable until we found an IDENTITY tag (ie {TEXTBOX1}) and then replace it witht he value of Text1 we had retreived formt he database.Once we have searched the variable for all indentity tags we can then write the varible to the screen.I am not sure if I explained it well but that is the basic idea

Link to comment
Share on other sites

Another option, if the site is basically static, is to store the template-y bits in INCLUDE files and INCLUDE them in your content-y pages. So, if you had a standard header and footer, your average content page would look something like this:-<html><#include file="inc_header.html"><h1>Welcome to JelloFreaks.com!</h1><p>blah blah blah</p><#include file="inc_footer.html"></html>Then you just need to change the header or footer INCLUDE file and Viola! (as they say), your whole site is changed. Whether you can do this or not depends on your server, however, so you'd need to do a little research. Ask your hosting service, and Google around a bit. Much easier than writing code, though regarded as a little old-fashioned (but what's wrong with that?)

Link to comment
Share on other sites

Thanks for the replies.  Looks like I might need to develop my w3 skills before I could properly do it.  I'll list this as a long term goal.

The other two options are better for certain things but another option is if you use Dreamweaver you can use the Dreamweaver template files.
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...