Click to See Complete Forum and Search --> : How to manage multiple pages
Thengel
12-06-2008, 03:27 PM
Hello folks!
I am making a website that hopefully will have a lot of pages after a while. So my my question is; how do I mange several pages at once?
I,m not talking about the CSS bit, I already use this. What I want is a standard page with the same logo on top, the same navigationmenu on the left, and a standard text on the bottom.
I know that i can use frames, but I'm not very fond of those.
Is there any other way?
tracknut
12-06-2008, 03:32 PM
Server side includes are the normal way to do this. Ie, each page includes a short header section, navigation section, and footer, so you can maintain those in their own (single) files.
So depending on your server language, you'd look to SSI, or PHP includes typically.
Dave
svidgen
12-06-2008, 06:23 PM
thepointless.com (http://thepointless.com) runs [almost] every request through index.php. The intended page is indicated by c=pagename. In this particular case, the main structure of the page and some helper functionality is stored in index.php, and a content file is pulled based on the value of GET['c'].
svidgen.com (http://svidgen.com) uses a variation of this, wherein the everything is run through index.php "invisibly." It takes advantage of URL rewriting (mod_rewrite (http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html)) to interpret URLs of the form */pagename.extension as */index.php?c=pagename&theme=extension.
index.php, taking some security precautions into account, looks up a .page file indicated by pagename, and determines whether to use a theme indicated by the .page file, the default theme file, or the theme listed in the query. Also note, when I say "theme file", I'm just talking about a PHP file that contains the HTML (or non-HTML) structure of the document and contains a particular variable located where all of the .page file's print() statements ought to be outputted.
So, http://svidgen.com/projects gets rewritten as http://svidgen.com/index.php?c=projects&theme= (http://svidgen.com/?c=projects&theme=). index.php finds no theme specified in the query and no theme specified in the .page file (I think), and uses default.theme. projects.page is executed, storing the printed lines in $some_variable, default.theme is executed (contains a print $some_variable; statement in the appropriate place), and then the whole thing is sent to the browser. Output buffering allows either the .page file or the .theme file to send headers as necessary.
Files of various types are located in specific directories with specific extensions on the server-side to assist in preventing unauthorized access to important files. Additionally, successive dots (..) are ignored (I think) to prevent referencing parent directories. Additional security measures are in place, and one should always been on the lookout for security holes in any template/theme system, as I am.
On that note, if anyone finds an exploit, please tell me! I'm only human, and I haven't thought of everything!
Make sense?
Thengel
12-07-2008, 03:48 AM
ooo...hhh....welll thanks svidgen...
I can't say I understood all that but I guess it will make more sense when I learn more about php.
One more question: Is it possible to manage php-pages on a regular PC?
Or do you have to load your pages onto a server? I still havent decided on a place to host my site so I only use my trusted laptop.
Did that question make sense?
svidgen
12-07-2008, 03:51 AM
The same basic concepts can apply to most any server-side scripting language used to implement a template system. And yes--Google WAMP.
Inga.
12-09-2008, 02:25 AM
Can you just use a template with editable regions for a simple site or am I being naive?