Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CSS/HTML>question 1

Status
Not open for further replies.

Flavor4real

Technical User
Jun 3, 2003
132
0
0
US
hello, how y'all doing... hope good..

question:

I have over 5000 single pages on a webproject.
what i wanna do is, i want to add to each of these pages a bottom table with some info. the info will be the same on all pages BUT if i have to make changes, i don't want to open each file.

so how can i make a MAIN file, a Mainfile where ican edit and stuff in it,...and in the smae way the main file will change all the other pages where the link is...

I've seen this before and it's pretty simple...
If i don't chatch the right words, then i'm sorry...i'm in a hurry and germany too...

I think in CSS there must be a way,..but if not let me know....

the hole ding actl. sct like a CSS sript.... .. i change the main,,... and all the others will be changed...

later

::::::::::::::::::::::::::::::::::::
:::::::::: 55-Studio.com :::::::::::
::::::::::::::::::::::::::::::::::::
 
use a server-side include. An SSI can take the contents of a MAIN file and paste it into any page that asks for it.

Google SSIs for more info (there's a whole host of SSIs for different web servers, covering things like date/time, date the page was last modified, and including other pages.)

<marc> i wonder what will happen if i press this...[ul][li]please tell us if our suggestion has helped[/li][li]need some help? faq581-3339[/li][/ul]
 
You want to add the same content to every page?

Sounds like a job for Server Side Includes (you can find some good tutorials via google), but on such a large scale I thing you would do better with a true Content Management System (CMS) - normally written in PHP.

Although less reliable, you can add common content to a page with javascript:

<script src="http:..js"></script>

Maybe I did not understand? :/

----------
I'm willing to trade custom scripts for... [see profile]
 
ok, ... i see, ... is it hard to develop a SSI file? i'm not into the CGI, PHP or ASP stuff,....

::::::::::::::::::::::::::::::::::::
:::::::::: 55-Studio.com :::::::::::
::::::::::::::::::::::::::::::::::::
 
dead easy. an ssi file is plain text.
save this as 'menu.ssi'.
Code:
<ul id="menu">
  <li><a href="/index.html">Home</a></li>
  <li><a href="/about.html">About</a></li>
  <li><a href="/contact.html">Contact Us</a></li>
</ul>

call it using a comment in the html, like this:
Code:
<!--#include virtual="/menu.ssi" -->

Don't forget to mod the web server: here's the instructions for apache (nb: this parses all files ending .shtml: alternatively you can skip the AddType and alter the AddHandler parameter to parse all .html files.)
Code:
AddType text/html .shtml
AddHandler server-parsed .shtml

<marc> i wonder what will happen if i press this...[ul][li]please tell us if our suggestion has helped[/li][li]need some help? faq581-3339[/li][/ul]
 
very nice FAQ Chris - I'll point people there next time! have a star :)

//marc
 
Works great. until you go to the page with javascript turned off. then you have no banner - and often no navigation.

the SSI code does EXACTLY THE SAME THING as the javscript code. it just does it server side. meaning it'll work even for those people on a corporate network when their sys-admin has turned j-script off.


<marc> i wonder what will happen if i press this...[ul][li]please tell us if our suggestion has helped[/li][li]need some help? faq581-3339[/li][/ul]
 
Whether you use javascript or SSI you still have the tedium of pasting the javascript or SSI include code into every one of those 5000 pages.

Once this is done you can easily change that one part of each page, but what if you decide you need to put or change a common element at the top of each page? Your back to editing all 5000 files again.

Using a server language like PHP would be better. You still need to change all 5000 files, but once done you can make other changes by only changing the PHP instead of every page.

Unfortunately, Flavor4real is "not into the CGI, PHP or ASP stuff,.... " so lets go another route. Use a program like Adobe GoLive or Dreamweaver.

With GoLive you would make an html template that has all your common elements (logos, nav, header, footer, etc). Then you assign the main content of each of your pages to an editable region in the template. Any time you change/add/delete/move any of the common elements in the template GoLive would go through all 5000 of your pages and make the changes for you. You don't need to know php or ssi or even html to use GoLive and in addition to this it has an enormous number of other features to help you out.

No matter what route you take you will need to edit all 5000 pages at least once. Why not take a PHP or GoLive route that prevents you from ever having to do that again.
 
Well covered wiser3.

If I had this task on my plate... I'd do a global find and replace (using my favourite text editor BBEdit for the Mac)for </html> and replace it with my include comment followed by the </html> again. Even though my footer.shtml would be blank... it would now be on every page... and into the future I just edit the footer.shtml to include new code on each and every page.

I also strongly recommend the use of an SSI file (and I'm very much a javascript supporter - but this is more suited to SSI than it is for javascript).

Jeff
 
I'd be inclined to go to town with my once-only edit, and try to leave my pages looking like this:
Code:
<html>
  <head>
    <title>This page's title</title>
    <!--#include virtual="/head.txt" -->
  </head>
  <body>
    <!--#include virtual="/top.txt" -->
    <p>
      This the unique content of the page!
    </p>
    <!--#include virtual="/bottom.txt" -->
  </body>
</html>
The idea being to leave only the content in each page, and to migrate the navigation and other standard stuff into SSIs.

Note that head.txt, top.txt and bottom.txt do not need to be well-formed HTML documents in themselves, they're just fragments of a larger document. You can, and will, open tags in top.txt that you close in bottom.txt.

-- Chris Hunt
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top