Space Pirate
Join Date: May 2004
Location: Atlanta
|
In the 'People' section of my Film-GA.com website I have made a little roll-through gallery of individual bios of people who work in the film industry in Georgia. The gallery works fine. The problem is that I'm lazy. I just made a tab-separated "control" text file for all of the entries and load that into an array. Easy peasy.
It goes: filename [tab] person's name [tab] department/job [tab] description [cr] This is great and easy and simple and all, but I've complicated matters by deciding to insert new entries alphabetically. As soon as I do that the numerical assignment for the entries that follow the new entry change. Bottomline: Ralph sends the URL of his entry to his mom, she checks the next day (after I've added Jenny) and all of a sudden she's seeing Paul's entry instead of her son's. I have to drive to a wedding today but thought that I'd jam this out here to see if anyone had recommendations as to the best way to fix this. I know that I'll have to write some code that alphabetizes the list for me, which will free me up from having to manage the control file myself. And in case you suggest mySQL you should know that I'm mySQL illiterate. This list of bios isn't going to be enormous anyway... it's like pulling teeth to get people to give you their info. |
quote |
25 chars of wasted space.
|
MySQL would work best but your way will work fine...just stop using numbers. What is the need to do this? I might not be getting something.
Quote:
|
|
quote |
Member
|
This doesn't help you with your current problem, but just for the future:
Don't fear the MySQL, databases are your friend! SQL is a really easy syntax to wrap your brain around, and I guarantee you can pick it up in 20 minutes. If its intalling MySQL, there is a prebuilt MySQL installer for OS X on the MySQL website. Last but not least there is a GUI that works pretty good for seeing your databases. Its called Cocoa MySQL. You can get the whole thing running without hitting the terminal at all. If you want to give it a whirl, I'm sure the folks here can help you with any issues you have. "Slow vehicle speeds with frequent stops would signal traffic congestion, for instance." uh... it could also signal that my Mom is at the wheel... |
quote |
Member
|
I think the easiest way to fix this is going to be to reference the people by their name, rather than an arbitrary number. Instead of: http://www.film-ga.com/?sec=people&p=1 use http://www.film-ga.com/?sec=people&p=Linda%20Burns. In order to get the previous and next URLs, just simply find the previous and next person in alphabetical order. This may be a bit more costly in terms of CPU time, but as long as you don't have a million people you should be fine.
|
quote |
Space Pirate
Join Date: May 2004
Location: Atlanta
|
The host for this site has a cherry installation of mySQL - I'm already using it to teach myself WordPress on the side so I'll take a look at some mySQL projects in a book I have and see if I'm motivated to learn it right now. Otherwise I'm going to give pmazer's suggestion a look-see as well as looking to see how easy it is to sort an array alphabetically... it can't be all that difficult, relatively speaking.
|
quote |
Space Pirate
Join Date: May 2004
Location: Atlanta
|
Oh wow, asort is awesome!!
I just tried it out and it's not the right solution this time around because I've just jammed people's full names into an array (no first/last setup).... the resultant sort is by the first letter of the first name. I've used pmazer's suggestion of simply passing the person's name instead of their slide number, which works great until it runs into an Irishman. Does PHP not like the Irish for some reason? http://film-ga.com/?sec=people&p=Timmy%20O'Brien I'm guessing that it's that apostrophe that it doesn't like? What to do, what to do... I'll be learning mySQL here soon. I've come to believe that organizing your data properly is more important than learning the tools to manipulate that data. EDIT: Crap. The single apostrophe wants to be escaped. Tracking down the &whatever; code for the single apostrophe now.... Last edited by drewprops : 2005-12-11 at 10:19. |
quote |
25 chars of wasted space.
|
I believe it's & #8217; (no space between the & and the #)
While I agree MySQL is the best way, you could just change how you load your information into the array. PHP has pretty great string manipulation functions, it would be easy to load their name separately into an array. |
quote |
Space Pirate
Join Date: May 2004
Location: Atlanta
|
I had a long-ass post about how I was testing for this case and that case. I had PHP code included, it was very neat. I did some output of various variables and found that PHP was automagically inserting a backslash in front of the apostrophe in the value passed by 'p'.
Then I remembered stripslashes() --- life is good. |
quote |
Selfish Heathen
Join Date: May 2004
Location: Zone of Pain
|
Quote:
For all your URL character-escaping needs: string urlencode ( string str ) |
|
quote |
Posting Rules | Navigation |
|
Thread Tools | |