> -----Original Message-----
> From: MEM [mailto:tal...@gmail.com]
> Sent: terça-feira, 27 de Outubro de 2009 12:05
> To: 'a...@ashleysheridan.co.uk'
> Cc: 'Jim Lucas'; 'php-general@lists.php.net'
> Subject: RE: [PHP] dynamic menu with show hide capabilities -
> understanding possible workflow
> 
> >Think of it a bit like an online shop selling operating systems:
> >
> >1) All the main OS's you sell are on the front page - Linux, MacOS &
> Windows
> >2) User clicks on Linux, and is taken to the url /products/linux and
> they are shown all the Linux OS's on offer >(Fedora, SuSe, Ubuntu,
> Knoppix, etc)
> >3) User clicks on Fedora and is taken to the URL
> /products/linux/fedora and they are shown all the versions of Fedora
> >up to 11
> >4) etc
> >
> >The URL belies what section you are on, which makes it easy for the
> user to remember, and easy for you to extract >information from to know
> exactly where the user is. Obviously in the above URLs I'm assuming
> mod_rewrite is being >used.
> >Thanks,
> >Ash
> >http://www.ashleysheridan.co.uk
> 
> 
> 
> Thanks a lot! Really.
> I will now start coding based on all this information and see what I
> will get.
> 
> I'm sure that the designer will kill me later, by telling me...
> couldn't we just... fade in this a little bit... Ahhrrggg!!!
> 
> 
> Regards,
> Márcio



Hello once again, 

I have take my time to think on this for a while.

And I end up on the W3C recommendations about URIs: 
In a phrase: Keep it semantic, lifetime, and short.


Several questions arise at this moment:
I was having a url like this:
http://www.mysite.com/c_mycontroller/method/1/3/4/54

Where the numbers where Id's of categories or products. Well... 
this could be as far as we can get from the W3C recommendations. :s

So, let's say I short those urls to names, and I remove/hide(?)
from the URL the controller and method information's. 
We could end up on something like this:

http://www.mysite.com/categoryname/subcategoryname/subsubcategoryname/productname/

It's more semantic. But what if we have, 4 subcategories for example? This 
could get quite long. 


A possible solution to this, is to have something like this:
http://www.mysite.com/categoryname/subcategoryname/productname

In a way that we always get no more than 3 URI segments.
So, if the user navigates to a sub sub sub sub level on the hierarchy, the 
address could be:

http://www.mysite.com/categoryname/subsubsubsubcategoryname/productname




1) What are your thoughts on this? Should I follow this track on your opinions?


2) In order to be semantic, I intend to pass through the URI segments, NOT the 
Category id's but the Category names.
This will bring two issues (at least):
2.1) - I need to query the database, not by ID but by Name. (I'm not sure if 
they always be unique, I'm not sure if I will have a performance issue). As a 
note: This is a VERY little website. Nothing too fancy. 


2.2) I will grab the categories name from the database, and build the URL with 
those names, however, some category names will have INVALID chars, like á, ç, 
spaces... etc... What would be the best way of doing this? Having a new column 
on the database categories table with a "slug" field? Or, grab the category 
name, and prepare that name to be "url friendy" using a function for that? If 
it's possible to answer, where on a MVC structure would this function be?



Regards,
Márcio


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to