Answered
Making Spyr Dynamic
Have searched for but could not find so I am asking:
Can someone clue me into how I can use a Collapsible Panel or Accordion Panel in a PHP page using a mySQL recordset and display the data from the recordset in the widget and have the widget work in a repeat region?
I am currently using a PHP page with a mySQL recordset and the data appears to be properly passed, I am just haven't been able to dynamically id (name) the Panel elements; and that, I think, is the problem.
The problem I am encountering is that only the first Collapsible Panel works properly. The remainder are displaying the data, but will not open and close when their tabs are clicked. It appears that all are being repeated as id="CollapsiblePanel1" (I am trying to use the Collapsible if possible rather than the Accordion, but either would work)
Does anyone have a way either javascript or php or other technique to increment the Tab & Content ID's?
I am attaching (I hope) a portion of the code i am testing with. Sorry, it's on a local server on my machine.
An example of something I think I want to do can be seen at Adobe example page :
http://labs.adobe.com/technologies/spry/samples/accordion/AccordionSample2.html
Any direction would be appreciated.
Thanks,
nitefisher1
Attach Code
<title>collapsible</title>
<script src="SpryAssets/SpryCollapsiblePanel.js" type="text/javascript"></script>
<link href="SpryAssets/SpryCollapsiblePanel.css" rel="stylesheet" type="text/css" />
</head>
<body>
<?php do { ?>
<div id="CollapsiblePanel1" class="CollapsiblePanel">
<div class="CollapsiblePanelTab" tabindex="0"><?php echo $row_rsPanel['gTitle']; ?> <?php echo $row_rsPanel['gAges']; ?></div>
<div class="CollapsiblePanelContent">
<div id=".ssCollapseLeft">
<p><?php echo $row_rsPanel['gTeachers1']; ?> <?php echo $row_rsPanel['gTeachers2']; ?> </p>
</div>
<div id=".ssCollapseRight">
<p><?php echo $row_rsPanel['gLocation']; ?></p>
<p><?php echo $row_rsPanel['gDate']; ?></p>
<p><?php echo $row_rsPanel['gAttend']; ?></p>
<p><?php echo $row_rsPanel['gContact']; ?></p>
</div>
<div id=".ssCollapseClear">
<p><!--<!--clear div -->
</p>
</div>
</div>
</div>
<?php } while ($row_rsPanel = mysql_fetch_assoc($rsPanel)); ?><script type="text/javascript">
<!--
var CollapsiblePanel1 = new Spry.Widget.CollapsiblePanel("CollapsiblePanel1", {contentIsOpen:false});
//-->
</script>
</body>
</html>
<?php
mysql_free_result($rsPanel);
?>
Can someone clue me into how I can use a Collapsible Panel or Accordion Panel in a PHP page using a mySQL recordset and display the data from the recordset in the widget and have the widget work in a repeat region?
I am currently using a PHP page with a mySQL recordset and the data appears to be properly passed, I am just haven't been able to dynamically id (name) the Panel elements; and that, I think, is the problem.
The problem I am encountering is that only the first Collapsible Panel works properly. The remainder are displaying the data, but will not open and close when their tabs are clicked. It appears that all are being repeated as id="CollapsiblePanel1" (I am trying to use the Collapsible if possible rather than the Accordion, but either would work)
Does anyone have a way either javascript or php or other technique to increment the Tab & Content ID's?
I am attaching (I hope) a portion of the code i am testing with. Sorry, it's on a local server on my machine.
An example of something I think I want to do can be seen at Adobe example page :
http://labs.adobe.com/technologies/spry/samples/accordion/AccordionSample2.html
Any direction would be appreciated.
Thanks,
nitefisher1
Attach Code
<title>collapsible</title>
<script src="SpryAssets/SpryCollapsiblePanel.js" type="text/javascript"></script>
<link href="SpryAssets/SpryCollapsiblePanel.css" rel="stylesheet" type="text/css" />
</head>
<body>
<?php do { ?>
<div id="CollapsiblePanel1" class="CollapsiblePanel">
<div class="CollapsiblePanelTab" tabindex="0"><?php echo $row_rsPanel['gTitle']; ?> <?php echo $row_rsPanel['gAges']; ?></div>
<div class="CollapsiblePanelContent">
<div id=".ssCollapseLeft">
<p><?php echo $row_rsPanel['gTeachers1']; ?> <?php echo $row_rsPanel['gTeachers2']; ?> </p>
</div>
<div id=".ssCollapseRight">
<p><?php echo $row_rsPanel['gLocation']; ?></p>
<p><?php echo $row_rsPanel['gDate']; ?></p>
<p><?php echo $row_rsPanel['gAttend']; ?></p>
<p><?php echo $row_rsPanel['gContact']; ?></p>
</div>
<div id=".ssCollapseClear">
<p><!--<!--clear div -->
</p>
</div>
</div>
</div>
<?php } while ($row_rsPanel = mysql_fetch_assoc($rsPanel)); ?><script type="text/javascript">
<!--
var CollapsiblePanel1 = new Spry.Widget.CollapsiblePanel("CollapsiblePanel1", {contentIsOpen:false});
//-->
</script>
</body>
</html>
<?php
mysql_free_result($rsPanel);
?>
