Jump to content

single navigation file


igordonin

Recommended Posts

I was talking to some friends, who are just as new as me in programming, and they think it would be better to use a single navigation file for every link in a web site.

 

Something like this:

 

<a href="nav.php?id=home&otherparams" >Home</a>
<a href="nav.php?id=products&otherparams" >Products</a>
<a href="nav.php?id=contact&otherparams" >Contact</a>
I told them I think this might be easier to maintain, but also might take up on loading time, as the site viewer will have to go through an extra node to get where he wants.

 

Is this single navigation file a good practice or should it be avoided?

 

Thanks for any comments...

Link to comment
Share on other sites

A lot of frameworks/cms packages will use a single routing file like that.  They typically employ URL re-writing to hide the fact that they do that though.

 

There's nothing wrong with using a single file like that so long as things are structured in a way that it is still easy to maintain the code.  A setup like that can be helpful when dealing with initialization code such as for your database connection/session information as well as template control.

 

 

Link to comment
Share on other sites

I made a site that all works off the index page and just loads any processing code above html and then content within page, based on page called with Get.  I used session to store current page from get and reloaded immediately so, Get's weren't obvious or could be taken advantage of.  These were of course checked against valid pages so anyone playing with get values didn't do anything.  So basically heading, footer stayed the same and content just changed.  Worked out well.  "Parts" were stored in different directories based on the name of the pages.  Anyway, that's what I did.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.