Switch Content Script: modify default expanded array
1) Script Title:
Switch Content Script
2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...tchcontent.htm
3) Describe problem:
When you create a new switchcontent object, you have to put the instance number(s) in the defaultExpanded method. I was wondering if anyone has successfully modified this for database driven dynamic content.
For instance, I would like those numbers to instead be unique ID's instead of array instances. Is this easily adaptable? I don't know JS
I actually came up with a solution using PHP.
I pulled out the unique ID's from a mysql database that I needed to work with using PHP, put them into an array, then used the array_keys() PHP function to reset the array's key numbers.
So my uniques went from ,, to ,,
I then used PHP's implode() function to turn the array into a comma delimited string, and stored it into a new variable.
Since my SQL query brought the records out in a certain order, the order of the newly created variable that stores the comma delimited string stayed the same.
You just have to start a new variable just for the switch content script, and not use the new ones for the actual data retrieval.