ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Distribution: Fedora Core 7 and older, Knoppix, Ubuntu
Posts: 121
Rep:
Putting same content on several web pages
I would like to create a web page that has the same disclaimer at the bottom of each page, and the same menu on the left side of each page. I would like a way so that I don't have to copy and paste all the code to each page so that to update the menu or disclaimer I would only have to edit one place and all pages would be affected. I have heard this is possible using css but I cannot find an example anywhere (normally I just view a pages source that does what I want, but the style sheets that a page uses don't show up doing that). I have tried looking at a tutorial but it doesn't cover that.
I know you can do this using frames, but it's been a long time. With CSS, I've had to copy the actual text onto each page. But the formatting of that text is what is controlled by CSS. Hmmm....
I have heard this is possible using css but I cannot find an example anywhere
It is possible to add generated content using the CSS :before and :after pseudo-elements. You would do that like this:
Code:
p#someid:after { content: "This is some text" }
However, you don't really want to use them for this. For starters, not all browsers support :before and :after. Internet Explorer, in particularly, will completely ignore these. Second, they're somewhat limited in the content they can display. They're really not geared toward displaying meaningful text. You'd be much better off with SSI or some very simple PHP includes.
I assume posting on a linux forums you would be using php which would make this very easy. When I used to make websites I would have a header.php and a footer.php.
The header would have the title and the top table and the left side table. The footer would have the right column and the footer. So each page would look like
Code:
<?php
include("header.php");
// code specific to page here
include("footer.php");
?>
then when you edited header or footer.php it was changed on each page.
I just fiddled around with server side includes and CSS. It's really easy (and Fun). You can just put the text for your list into a file and call it from within your html.
For example, your file, navbar.ssi would be the following
If you're creating the site from scratch, rename your files .shtml (the webserver typically won't parse html files for SSI instructions). If you have to redo a site, there's something called the XBitHack that causes the server to parse regular html files for SSI instructions only if the execute bit is set (i.e. chmod +x index.html). Then you can control the format of the page from your CSS file and keep a separate navbar and footer. Maybe put all the common stuff in a single directory like "include". Then you know where it all is to edit.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.