[eluser]dizzyagain[/eluser]
[quote author="noctrum" date="1304439219"]If you're browsing data relating to a year, one would assume you have dates associated with that data in the DB in some way. I can think of a half dozen different ways to fetch the available date range from the database, and they're all better than forcing yourself to create new controllers every year.
Maybe I'm just not understanding the question, but tasks such as "see all ‘people’ relating to 2009" is exactly what a database is intended for. I see no benefit in trying to create a file structure around this.[/quote]
Yes I understand how to fetch the appropriate years data from a table - what I am struggling with is a logical way to present the site to a user (and therefore how the controller structure will look).
Allow myself to explain further;
Currently the app is quite simple, in a sidebar menu a user can choose from a menu allowing them to list certain things from different tables (i.e people). As it stands the entire table contains records from only one year.
URI examples:
Code:
myapp.com/people
myapp.com/cars
myapp.com/films
The plan is to extend the database tables by adding a field for year - so that I can make queries to return entries that match a certain year.
Writing the queries I have no problem with but I am a bit stuck on how to get the app design right in the most simple and effective way.
The below example will illustrate two very different ways of 'designing the controllers' (the second using controller remapping) - but I'm not sure if either are the best way!!
Code:
myapp.com/2008/people
myapp.com/2009/people
myapp.com/2010/people
Code:
myapp.com/people/2008
myapp.com/people/2009
myapp.com/people/2010
Perhaps my own visualisation of the user experience is tripping me up; Rather than having a main menu listing all the things (tables), and once you have chosen one, it listing by default all records from the most recent year with a dropbox allowing you to change to years in the past - I would like the user to choose a year off the bat, therefore every item in the main menu will show them the results of the year that they are currently viewing (always while having a prominent option (such as dropdown) to switch to a different year).
An analogy that came to me as I wrote the above sentence was exactly like the way 'localising' an app works with languages - once a user has selected a language they see all the same pages in the menu but with a different language.
I may just be over-thinking all of this - and I apologise if this isn't making sense! I guess this is a very general theoretical app design question... Asking if anyone has some tips on the most sensible way to achieve this.
Cheers