Solved

Should I have one header?

Posted on 2016-09-11
3
59 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 110

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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

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…
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
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…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

623 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