I'm working on a gallery type site and the client wants the initial gallery scroller to display in the following order:
1. Fashion
2. Beauty portraits
3. Music
4. Fine Art
5. Places and faces
6. Food
7. Love
I'm not really troubled by how to create this but what bothers me is future-proofing it. Imagine this scenario: a new directory ('Simplicity' is added to the mix and the client wants it between Music and Fine Art. I could simply add the new gallery into the array but what if i wanted this to be an automated process; how would i do it?
Any ideas about this would be welcomed; not looking for code but more for insights into how this problem can be approached / handled.
Creating specific order from an array and future-proofing it
Moderator: General Moderators
- social_experiment
- DevNet Master
- Posts: 2793
- Joined: Sun Feb 15, 2009 11:08 am
- Location: .za
Creating specific order from an array and future-proofing it
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
Re: Creating specific order from an array and future-proofin
I would store the list in a database table or text file to be manipulated via an HTML form interface.
- The database table should include a field to hold a sequence number so the order of the list would not necessarily depend on the actual order of the rows.
- The text file could hold the list items, one per line, sorted in the desired order. Or the text file could be CSV-formatted and include sequence numbers like the database table.
- social_experiment
- DevNet Master
- Posts: 2793
- Joined: Sun Feb 15, 2009 11:08 am
- Location: .za
Re: Creating specific order from an array and future-proofin
The file option is one i might consider; the project is almost finished so i don't want to (or couldn't at this time) create a back-end as well, albeit a simplified one.
Currently i have this idea: I have a base class that will accept the array containing the directory names as an argument (for the constructor). Then there are two additional classes; call them A_Page_Model and A_Gallery_Model that will create galleries, they will then use the array to create the galleries. This method works good for me and other developers but not so well for a client with 0 experience in scripting. This whole method would mean manual entry of the new values so good-bye automation if i go with this route.
Another thing i have to consider is ease of use; if i have to handle this myself that's no problem but i might not always be available to do an update when the client requires it. So it boils down to 3 potential users that will do 'changes' to this: me, 3rd party programmers & the client themselves. I can add comments for other programmers but the client is the big issue. I consider all clients tech-noobs till proven otherwise and i can't have them messing around in the script
Currently i have this idea: I have a base class that will accept the array containing the directory names as an argument (for the constructor). Then there are two additional classes; call them A_Page_Model and A_Gallery_Model that will create galleries, they will then use the array to create the galleries. This method works good for me and other developers but not so well for a client with 0 experience in scripting. This whole method would mean manual entry of the new values so good-bye automation if i go with this route.
Another thing i have to consider is ease of use; if i have to handle this myself that's no problem but i might not always be available to do an update when the client requires it. So it boils down to 3 potential users that will do 'changes' to this: me, 3rd party programmers & the client themselves. I can add comments for other programmers but the client is the big issue. I consider all clients tech-noobs till proven otherwise and i can't have them messing around in the script
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
Re: Creating specific order from an array and future-proofin
If you store the list in a text file, you can use the modification time to determine when to regenerate the cache file.