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.
I'm trying to understand how to build web pages so that I don't have to have
the same "page" for every little thing I update or what not.
For example:
I have a basic "template" that my entire site uses. I've got the title and some
navigation links at the top of all my pages, but I have the exact same code in
all of my pages to display the title and nav links.
So if I want to change or add or delete one of the links I have to go through
all the pages and edit each one manually. (Actually I use sed and awk to help
ease my pain but still). Since my site follows the same "look" throughout all
of the pages and only the content of the tables or whatnot change slightly, I
would like to do it in a more dynamic way.
Some of the look can be incorporated into CSS, but maybe you are already doing that. Since I use php a lot even for simple sites I create my own header and footer and just include them in each page. Then I only need to change the code once to have it reflected throughout the site.
Well, one way to accomplish what you want simply is with SSI - server side includes.
It works like this:
1. In the Apache httpd.conf for the directory, add:
Options Includes
2. Create the file(s) containing the variable content. For example, if you create an "includes" directory in your web document root, you can create an "includes/stuff1.html" file containing a link (or any block of html):
i would agree with graemef on including a header and footer. i also do that. you could also make a function that will print out a certain part of a page (a nav bar for example) when called.
i am also speaking from a php view..
SSI, wow. i almost forgot about SSI. i havent used SSI for 5 years atleast. i think things like php have put the hurts to SSI usage..
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.