CMS and Spry

7 posts by 2 authors in: Forums > CMS Builder
Last Post: June 10, 2010   (RSS)

Re: [dccreatives] CMS and Spry

By Jason - June 8, 2010

Hi,

What you can do is have a variable that increments through each loop and is added to the id of each div. So the divs are number "CollapsablePanel1","CollapsablePanel2", etc.

On line 85, just above the beginning of your foreach loop, add this code:
<?php $index=1; ?>

Next, use this where you're outputting your <div> tag:

<div id="CollapsiblePanel<?php echo $index;?>" class="CollapsiblePanel">
<?php $index++; ?>


Give this a try and let me know if you run into any issues.

Hope this helps.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Jason] CMS and Spry

By dccreatives - June 9, 2010

It is still not working.

http://www.axislighting.com/CMS/downloadsList.php If you click on the Dia Box, it will open, the rest are open and do not close as they should.

I think I also need some php to add the script tag to make them all closed Right now the first one is closed (#1) and the rest are all open.

This is the script I have now.

<script type="text/javascript">
<!--
var CollapsiblePanel1 = new Spry.Widget.CollapsiblePanel("CollapsiblePanel1",{contentIsOpen:false});

//-->
</script>
Attachments:

downloadsdetail.php 7K

Re: [dccreatives] CMS and Spry

By Jason - June 9, 2010

Hi,

Try using this for your javascript:

<script type="text/javascript">
<!--
var CollapsiblePanel<?php echo $index; ?> = new Spry.Widget.CollapsiblePanel("CollapsiblePanel<?php echo $index; ?>",{contentIsOpen:false});

//-->
</script>

Since this javascript is written for each panel, it will append the index number to the end of the javascript variable.

Hope this helps.

---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Jason] CMS and Spry

By dccreatives - June 10, 2010

Sorry to make you crazy, but now it does not work at all. the first is now open and it does not close when clicked on. Here is the page. http://www.axislighting.com/CMS/downloadsList.php

Attached is the file again.
Attachments:

downloadslist_001.php 8K

Re: [dccreatives] CMS and Spry

By Jason - June 10, 2010

Hi,

One this I noticed is that you put your javascript down at the very bottom of your foreach loop, but you're incrementing your $index variable at the very top. This means you never have any javascript for the first panel, and the rest of them would be off by 1. Try taking this code:
<?php $index++; ?>
at put it at the very bottom of your foreach loop (line 186)

Hope this helps.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Jason] CMS and Spry

By dccreatives - June 10, 2010

Thanks it perfect.