Solved

Should I have one header?

Posted on 2016-09-11
3
30 Views
Last Modified: 2016-09-11
I have a header for the index page, and a header for the rest of the pages. The reason I'm doing this is because the index pages are domain.com/index and the other domain names are domain.com/page/index.

This means in two places - both the menu and the external css/javascript the directory listing is different (i.e. css and ../css) - same thing in the menu.

So like I said I have a header for the index pages, and a header for the rest of the pages.

Is this desirable or should I code something else? Please describe how it should be coded if I should have something else.

Thanks
0
Comment
Question by:burnedfaceless
3 Comments
 
LVL 29

Assisted Solution

by:Olaf Doschke
Olaf Doschke earned 250 total points
Comment Utility
Look into URL rewriting. A url like domain.com/page can be rearranged into doimain.com/index.php?detail=page or similarly parameterized script.

This way any level of "folders" in the URL does not really address that folder structure, the sections /.../.../ just become parameters to a central controller, which then only needs one html header.

Side note: Even not going that way, you can avoid .. by using /css, / always going to the root, no matter where you are.

Back on the rewriting track, though, as it's a very good concept to structure urls seo friendly: You can write a simple webserver rule and handle all detail routing in a PHP script, that can act depending on $_REQUEST and/or $_SERVER['REQUEST_URI'] and just react with Location headers going to some controller script. Advantage of this is you can react to requests very individually.

mod_rewrite is the apache way of working with redirects and is based on regular expressions. It's advantage is fastest way to handle the redirection to whatever base controller script, disadvantage is this is all based on regex and hardly intuitive.

Both approaches have in common, that the uri structure is NOT reflected in a real folder structure, every request mainly goes through one or two scripts in webroot, perhaps in some other folder.

Perhaps take a look at the project folder structure of some CMS you just download and install to have a blueprint giving you the ideas you need, not only in this aspect.

Bye, Olaf.
1
 
LVL 108

Accepted Solution

by:
Ray Paseur earned 250 total points
Comment Utility
You can make all of your include paths relative to the document root.  That way, your CSS and JS directories can exist in one place and do not have to be proliferated across multiple directories.

Often home pages are simpler than detail pages, so your CSS cascade might include all the home page look-and-feel on every page (color schemes, etc), with more refinements to the CSS on the detail pages (layout).
0
 

Author Closing Comment

by:burnedfaceless
Comment Utility
Thanks have something working now.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

This article will explain how to display the first page of your Microsoft Word documents (e.g. .doc, .docx, etc...) as images in a web page programatically. I have scoured the web on a way to do this unsuccessfully. The goal is to produce something …
Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now