Solved

Should I have one header?

Posted on 2016-09-11
3
50 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
ID: 41793396
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 109

Accepted Solution

by:
Ray Paseur earned 250 total points
ID: 41793415
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
ID: 41793565
Thanks have something working now.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Decrypt string by php 7 48
Could you point a way to obtain a specifically  DateInterval Object value? 2 21
IP 10.0.1.2 / 255.0.0.0 61 57
Inserting data into database 10 36
Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

821 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