# Using CSS to update entire website?



## PaulusMaximus (Oct 7, 2010)

Hi, n00b of epic proportions here. Sorry to ask such a silly question, but I've searched everywhere and I just can't seem to find any information on it.

Basically, I've got a side bar on my site that I want to constantly update with new information. How do I do that without having to edit 50 html files? I remember doing this years ago with CSS on another site, but my memory's rusty and I've totally forgotten the knack for it. 

Thanks in advance guys.


----------



## maneetpuri (Oct 14, 2008)

Hi,

Using CSS you can manage the style & formatting of multiple pages, but the content has be managed from the respective page. But if there is some content area (side bar in your case), which is being repeated on all the pages what you can do is make one file and include it on all the pages, with this you will be able to manage this from one page.

Hope this helps,

Cheers,


----------



## PaulusMaximus (Oct 7, 2010)

Hey, thanks for your reply.

So how I would I go about doing this? Do I have one css file with just the content and I just link every page to that?


----------



## WendyM (Jun 28, 2003)

Hi Paulus, welcome to TSG.

It sounds like you're a little confused about how CSS works. As maneetpuri said, CSS controls the style and formatting, but not the content. The benefit of CSS is that you can tell it that you want all your backgrounds to be green (for example) and you don't have to say that on every page, you just say it once and then yes, link all of the pages to your stylesheet. The even better benefit is that if you decide in the future you want all of your backgrounds to be blue, you'd only need to update it once on the stylesheet and it would carry through to all the pages.

For content that gets reproduced on each page (like a menu of the latest news items), you'd need to create an HTML page (or asp or php or whatever you're using). Then you'd include that file on each page, so that basically each page would be calling the menu page. Then when you needed to update, you'd update the menu page only and it would flow through to all of the other pages. What software are you using to edit your site?


----------



## PaulusMaximus (Oct 7, 2010)

Right, I see what you're saying. I edit my code directly BTW. 

So what's the code for inserting my menu content file into html then? 

Thanks for your help, I'm really appreciating the effort and quick responses here.


----------



## WendyM (Jun 28, 2003)

Are you using Apache or IIS? What's the file name extension on your files? If it's HTML you'll need to change it to something like .shtml, .stm, .shtm, .asp, etc. You can actually just rename your extensions without changing any code in the files. If you're using IIS, it's probably easiest to rename your pages to .asp and the server-side include will work without any configuration. The included file (your menu) can still be .htm or .html but the file you're including it in needs to be one of the other extensions. So, for example, if you had index.asp and you wanted to include menu.htm, the code that you need to insert in index.asp is


```
<!--#include file="menu.htm" -->
```
If you're using php, the code is


```
<? ? readfile("menu.htm"); ?>
```
Hope this helps to get you started.


----------



## PaulusMaximus (Oct 7, 2010)

Ahhhhhhhh now it's making sense. The shtml file extension rings a bell, I must have got that muddled up with CSS for some reason. I haven't got a clue about the difference between apache or IIS. How can I determine what type my file is then? (btw, I haven't uploaded this site to the net just yet) Once I do determine the file type, shall I go with the shtml extension or the .asp? 

Thanks again, and I do apologise for being such a filthy n00b to all this.


----------



## WendyM (Jun 28, 2003)

Apache and IIS are web servers, so it will depend on where your site is going to be hosted. Are you hosting it yourself (as in, you own and control the web server) or are you going to pay to have it hosted?


----------



## PaulusMaximus (Oct 7, 2010)

I'm going to be paying to have it hosted.


----------



## WendyM (Jun 28, 2003)

Once you decide on a web host (if you haven't already), you'll need to check with them to determine which web server they're using. This is just my opinion and others feel differently, I'm sure, but if it's IIS, I'd go ahead and rename the extensions to .asp. If it's Apache, use .php. That will give you the flexibility to use those pages for actual programming (for example, using VBScript with asp) in the future without changing the extensions again. However, if you don't think you'll ever do any programming beyond HTML, you could use .shtml and then it'd be easy to transfer the pages from IIS to Apache or vice versa if you need to. Asp and IIS are both Windows tools, so if you needed to move your .asp pages to Apache in the future, you'd have to make changes to Apache to get it to work. Which is all a long of way saying that any of them will work, you just have to give a little thought to your future objectives.


----------



## PaulusMaximus (Oct 7, 2010)

Brilliant, I think that just about covers everything. :up: I'm basically using my site as an online portfolio, so I don't think I'll be needing to use php or anything like that. Thanks a lot though for taking the time out to answer my questions, it really is appreciated.


----------



## lordsmurf (Apr 23, 2009)

You don't have to change extensions. There's no reason for that.
At one point, I set my server to recognize .html to run under the PHP engine. You can also set SSI to run off plain .html or.htm

It really depends on the server in use, as to what can be done.


----------

