CMS and Spry

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

By dccreatives - June 8, 2010

I would like to incorporate some spry collapsible panels on my page: I was able to insert it perfectly for the first one, the problem is that when it loops and has the same name, it does not work.

You can see a sample on this page: http://www.axislighting.com/CMS/downloadsList.php THe first one works, the rest don't because the name is looping as the same div id and it will not work. Anyone out there with an if then statement to give each panel a new name and also add it to the script to keep looping?

Thanks
Attachments:

downloadslist.php 6K

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

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

Thanks it perfect.