Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Should I have one header?

Posted on 2016-09-11
3
Medium Priority
?
62 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 30

Assisted Solution

by:Olaf Doschke
Olaf Doschke earned 1000 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 111

Accepted Solution

by:
Ray Paseur earned 1000 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: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone 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

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…
I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
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.

705 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