View Full Version : Content Switcher II on dynamic tables

10-21-2005, 04:42 PM
I have a bit of PHP that creates tables on the fly that I am trying to incorporate Content Switcher II into. I get it to work mostly, but I am getting hung up on the static ID. I have only one table and several other are generated from the one template.

When I use Content switcher, I get the first table to expand/contract and I can use the global expand contract, but if I click on any other table, it only expands and contracts the frist table. So if I have 4 tables, and I click on the 4th one, the first one will expand/contract and the fourth will remain unchanged.

Is there any possibility of being able to use Content Switcher for this of scenario?

10-24-2005, 12:49 PM
Any ideas on this?

10-24-2005, 02:04 PM
What exactly do you mean by static ID? If all of your expandable content sections have the same ID, this type of behavior is what I would expect. If I recall correctly, in the original script, each section has a unique ID, incremented by one. Like sc1, sc2, sc3, etc. Does your PHP code generate id's like that or not?


10-24-2005, 02:26 PM
no it doesn't. There is a php file that takes the table in the template file and creates however many it thinks it needs from that template file. The template only has one table in it. Here is the link to page


The page is sort of a mess and has other errors on it, but I figure I can work those out after i get this thing to work

Original script - http://www.dynamicdrive.com/dynamicindex17/switchcontent2.htm

10-24-2005, 02:47 PM
That would be the trouble or at least one problem. The generated code on the 'power metal' style has all the same ids. Your PHP code that generates the tables needs to assign unique ids in the form expected by the script. Instead of:


for each one, get it to write out:



and so on.

10-24-2005, 03:50 PM
doh! ok. Now to go figure out how to do that. I'm still learning this stuff