Solved

Should I have one header?

Posted on 2016-09-11
3
39 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 108

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

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 …
Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
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 create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

943 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

7 Experts available now in Live!

Get 1:1 Help Now