How can I get the effect of a Dreamweaver template without the template?
August 24, 2006 2:34 PM   Subscribe

How can I make text in one cell on one html page appear in the same cell on a different subpage?

Live and learn I guess. I have a website where every page has a table cell in the same place. Originally it was designed so that information, links, images, etc. could go in that space that was relevant to the information in the main part of the page--sort of like a sidebar. Now it appears that this is only going to happen on some of the pages.

My boss wants to maintain the page layout as it is, but we don't want that "sidebar" cell to be empty on some of the pages, so he wants to put the "news" content from the front page (which also has this sidebar cell) on all the pages where the sidebar is empty. Of course all the pages are more or less done now.

My website making skill is pretty limited, clearly. I'm using Dreamweaver 8, and I've determined that I probably could have solved this pretty easily with nested templates if I had started with them from the beginning. Now that it seems too late for that, is there a simple Dreamweaver way to change the text in one place and have the change reflected wherever else I say without wrecking the existing content on a subpage? Or, is there an HTML way that I could put the same code in each cell that then somehow grabs the text from somewhere and puts it in the cell (nicely formatted)?
posted by sevenless to Computers & Internet (6 answers total) 1 user marked this as a favorite
My html knowledge is quite rudimentary, but it seems to me that if you put the "news" content in a server-side include, you could then have it appear anywhere in the website you want it to appear. That seems like it would do exactly what you want to do.

Server-side includes allow precisely the modularity you're looking for.

Look up "server-side includes" on Google and you'll find a ton of information about them.
posted by jayder at 2:46 PM on August 24, 2006

jayder beat me to it. SSI is definitely the way to go.
posted by TimeTravelSpeed at 2:49 PM on August 24, 2006

I also recommend server-side includes. Just to throw out an alternative, you could also use an iframe. SSIs sound like the best choice for little chunks of news, though.
posted by adipocere at 2:55 PM on August 24, 2006

Well, that was easy.

Now I have to change all the extensions to .shtml, but I think I can deal with that.

posted by sevenless at 3:20 PM on August 24, 2006

You may not have to rename the file extensions at all, actually.

Some hosts will let you add a line to your .htaccess file (a little hidden text file that lets you apply various settings to the server) that will let SSIs run in files with the regular .html extension. I believe it's something like:

AddHandler server-parsed .html
posted by bcwinters at 4:22 PM on August 24, 2006

Thanks bcwinters. Apparently my host will let me do that. And, that is the right directive (at least for Apache servers.)
posted by sevenless at 4:57 PM on August 24, 2006

« Older How can I keep my mattress topper on top of my...   |   Legality of public restaurant unmarked audio/video... Newer »
This thread is closed to new comments.