Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
CSS Cascading Style Sheets All issues relating to Cascading Style Sheets (CSS).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the CSS Cascading Style Sheets section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 1st, 2006, 04:01 PM
Registered User
 
Join Date: Jun 2006
Location: Seattle, WA, .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default "embedded" element???

I'm preparing to build a website for my wife's small business - I have a solid background in (x)html and am learning the in's and out's of CSS. But one thing I can't seem to find is a way to "embed" a portion of the page (if embed is even the correct word).

She is going to have several dozen pages as part of her site - but the left column (containing the links) will remain basically the same for each page. What I'd like to do is create that column as a separate .html document, and have each page "point" to it to fill in the space. This way, if I did ever need to change a link, I can do it once, and not have to go to each of the several dozen pages individually (think: frames).

A) Does this make sense? B) Can it be done using CSS?

Marcus
 
Old June 1st, 2006, 05:16 PM
Friend of Wrox
Points: 1,315, Level: 14
Points: 1,315, Level: 14 Points: 1,315, Level: 14 Points: 1,315, Level: 14
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: , , .
Posts: 425
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Hello and welcome. :)

A) Yes.
B) No.

CSS is for styling existing content, not for providing the content. What you want is SSI (Server Side Includes). SSI isn't a real programming language, it's more of a limited set of directives that can be used to include files or variables. The same thing can be done with real programming languages like PHP.

It's very easy. You can think of it like cutting out pieces of the page with a pair of siccors. You can cut wherever you want. Save the cutouts to their own files. Then you insert special comments where you want the pieces pasted back. The server parses the HTML, looking for those comments, and inserts the corresponding files before the page is sent to the browser. And the page is whole again! :D


                                    ^^^^^
(note the space before the closing "-->")

You must also tell the server to parse the pages for SSI. Usually by renaming the pages .shtml, but that can be changed.

If you use Apache you can read about SSI here:
http://httpd.apache.org/docs/2.0/mod/mod_include.html
http://httpd.apache.org/docs/2.0/howto/ssi.html

PHP:
http://se2.php.net/include/

You can find more easy to read tutorials through google.

--
http://yupapa.com
 
Old June 1st, 2006, 05:52 PM
Registered User
 
Join Date: Jun 2006
Location: Seattle, WA, .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank you thank you for the quick response. Since I didn't see a solution in any of the CSS books I read through, I thought the answer might be thus - but than again it may have just been so obvious as to not address it.

The solutions you suggest are not familiar to me - so I'll have to look into them.

Thanks again!

 
Old June 1st, 2006, 06:42 PM
Friend of Wrox
Points: 1,315, Level: 14
Points: 1,315, Level: 14 Points: 1,315, Level: 14 Points: 1,315, Level: 14
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: , , .
Posts: 425
Thanks: 0
Thanked 3 Times in 3 Posts
Default

You're welcome.

Yes, read up a little before you decide. You must check what's available to you on the server too. If you are on an Apache server, most likely both SSI and PHP are there. On Windows you'll have ASP. I *think* SSI is used in that case. I don't think ASP has its own include mechanism.

--
http://yupapa.com




Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem adding element to the previous element dani1 XSLT 5 September 10th, 2008 01:38 AM
embedded <xsl:element> into <xsl:with-param> petergoodman XSLT 2 July 9th, 2008 06:36 AM
Embedded or not NEO1976 EJB 0 April 3rd, 2007 09:45 AM
translate element name to element name lexzeus XSLT 3 September 4th, 2006 09:04 AM
adding of element and assigning to one element sushovandatta XSLT 2 November 16th, 2004 07:04 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.