close ad
Databridge V2 with MySQLi support IS Now Available!
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Nested repeat region in a spry accordion

Thread began 4/13/2011 12:07 pm by John Langer | Last modified 8/22/2014 1:07 pm by Jason Byrnes | 5595 views | 13 replies |

John LangerBeta Tester

Nested repeat region in a spry accordion

Hi

I've attached the files.

I have a spry accordion. The labels and content are coming from two separate MySQL tables. I have the content in a DataAssist repeat region and then the whole accordion in another repeat region.

The panels are repeated, The labels are repeated OK. The first panel shows the repeated content as a list, the second panel (Publicity) is empty but should have another repeated list of content.

Here's a link to the webpage in question (just a basic style, I'm just trying to see if it works).

If anyone could offer help with this I'd be grateful.

Attached Files
download_test.zip
Sign in to reply to this post

Jason ByrnesWebAssist

the code for the rs downloads recordset:

php:
$colname_rsDownloads = "-1";

if (isset($row_rsDownloadCats['downloadCatID'])) {
  $colname_rsDownloads = (get_magic_quotes_gpc()) ? $row_rsDownloadCats['downloadCatID'] : addslashes($row_rsDownloadCats['downloadCatID']);
}
mysql_select_db($database_connCvmOrg, $connCvmOrg);
$query_rsDownloads = sprintf("SELECT * FROM members_downloads WHERE FKdownloadCatID = %s", GetSQLValueString($colname_rsDownloads, "int"));
$rsDownloads = mysql_query($query_rsDownloads, $connCvmOrg) or die(mysql_error());
$row_rsDownloads = mysql_fetch_assoc($rsDownloads);
$totalRows_rsDownloads = mysql_num_rows($rsDownloads);




needs to be moved so that is just before the second repeat selection:

php:
<div class="AccordionPanel">

    <div class="AccordionPanelTab"><?php echo $row_rsDownloadCats['DownloadCategory']; ?></div>
    <div class="AccordionPanelContent">
      <ul>
      <?php
      $colname_rsDownloads 
"-1";
if (isset(
$row_rsDownloadCats['downloadCatID'])) {
  
$colname_rsDownloads = (get_magic_quotes_gpc()) ? $row_rsDownloadCats['downloadCatID'] : addslashes($row_rsDownloadCats['downloadCatID']);
}
mysql_select_db($database_connCvmOrg$connCvmOrg);
$query_rsDownloads sprintf("SELECT * FROM members_downloads WHERE FKdownloadCatID = %s"GetSQLValueString($colname_rsDownloads"int"));
$rsDownloads mysql_query($query_rsDownloads$connCvmOrg) or die(mysql_error());
$row_rsDownloads mysql_fetch_assoc($rsDownloads);
$totalRows_rsDownloads mysql_num_rows($rsDownloads);
?>
        <?php
    
// RepeatSelectionCounter_1 Begin Loop
    
$RepeatSelectionCounter_1_IterationsRemaining $RepeatSelectionCounter_1_Iterations;
    while(
$RepeatSelectionCounter_1_IterationsRemaining--){
        if(
$RepeatSelectionCounterBasedLooping_1 || $row_rsDownloads){
?>
Sign in to reply to this post

John LangerBeta Tester

As usual Jason, you've cracked it.

Many, many thanks it works a treat now.

Sign in to reply to this post

Jason ByrnesWebAssist

you're welcome.

Sign in to reply to this post

MarkBeta Tester

Could be same problem?

Hi Jason,

Just wondered if you have any advice or help on my problem using a nested WA repeat?

I have an accordion also.

The header titles of the accordion comes from a recordset which lists all the continents (Select All ).

And the contents are loaded from a recordset which is made up of a Joined table of the header titles table, joined to the foreign key of the contents table.

My problem is that I can get the headers to display all the accordion titles etc (pulled from the Select all recordset) but I cannot get the contents to appear within each of the content of the relevant tabs of the accordion? The content recordset placeholder tag has been give a WA Repeat behaviour.

Any thoughts - bit of a challenge this?

turtletravel.co.uk/newindex2.php

K Reg, Mark

Sign in to reply to this post

Jason ByrnesWebAssist

for doing this, you need to have 2 recordsets, one recordset that returns the parent items, and a second recordset that returns the child items, the second recordset needs to be nested inside the loop

the format of the code will look lie this:

-parent recordset
-parent recordset loop
--write label
--child recordset, filters using the ID from the parent recordset
--child recordset loop
---write child info
--end child recordset loop
-end parent recordset loop

Sign in to reply to this post

Sweens

Hi Jason

I'm trying a similar thing with a bootstrap accordion. I get the outer repeat OK, but the records in the inner repeat aren't tied to the selected item (in this case, a date).

I have tried using a WA Repeat selection, but the page keeps timing out, so the attached uses the standard DW Repeat Region.

Any help much appreciated, as ever

Chris

Attached Files
menu-dates.php
Sign in to reply to this post

Jason ByrnesWebAssist

need more info.


  but the records in the inner repeat aren't tied to the selected item (in this case, a date).  



i dont follow what you mean by this. I'm nit even sure what section of code i should be looking at.

Sign in to reply to this post

Sweens

Sorry, Jason;

The folowing is the complete repeat region:

<?php if ($totalRows_rsDates > 0) { // Show if recordset not empty ?>
<div class="col-sm-5">
<div class="panel-group" id="accordion">
<?php do { ?>
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse" data-parent="#accordion" href="#collapse<?php echo $row_rsDates['ref']; ?>">
<?php echo $row_rsDates['mnu_date']; ?>
</a>
<p class = "pull-right">confirm | update | delete</p></h4>
</div>
<div id="collapse<?php echo $row_rsDates['ref']; ?>" class="panel-collapse collapse <?php /*START*/ if ($rsDates['RNo']="0"){ ?>
in<?php /*END*/ } ?>">
<div class="panel-body">
<?php do { ?>
<?php /*START*/ if ($rsFutMenus['ref']==$rsDates['ref']){ ?>
<img src="../img/products/thumbs150/<?php echo $row_rsFutMenus['ProductImage']; ?>" /><?php echo $row_rsFutMenus['ProductName']; ?> £<?php echo $row_rsFutMenus['ProductPrice']; ?> | <?php /*END*/ } ?>
<?php } while ($row_rsFutMenus = mysql_fetch_assoc($rsFutMenus)); ?>
<?php
// reset the recordset after a repeat region
mysql_data_seek($rsFutMenus, 0);

// get the first row from the recordset
$row_rsFutMenus = mysql_fetch_assoc($rsFutMenus);
?>
</div>
</div>
</div>
<?php } while ($row_rsDates = mysql_fetch_assoc($rsDates)); ?>
</div>
</div>
<?php } // Show if recordset not empty ?>

The 'inner' part of the accordion is

<?php do { ?>
<?php /*START*/ if ($rsFutMenus['ref']==$rsDates['ref']){ ?>
<img src="../img/products/thumbs150/<?php echo $row_rsFutMenus['ProductImage']; ?>" /><?php echo $row_rsFutMenus['ProductName']; ?> £<?php echo $row_rsFutMenus['ProductPrice']; ?> | <?php /*END*/ } ?>
<?php } while ($row_rsFutMenus = mysql_fetch_assoc($rsFutMenus)); ?>
<?php
// reset the recordset after a repeat region
mysql_data_seek($rsFutMenus, 0);

// get the first row from the recordset
$row_rsFutMenus = mysql_fetch_assoc($rsFutMenus);
?>
</div>
</div>
</div>
<?php } while ($row_rsDates = mysql_fetch_assoc($rsDates)); ?>

I've tried to relate the 'inner' to the tab heading by using <?php /*START*/ if ($rsFutMenus['ref']==$rsDates['ref']){ ?> but this just shows all records, for some reason.

Cheers
Chris

Sign in to reply to this post

Jason ByrnesWebAssist

I Still don't follow, please provide more details on what it is you are trying to accomplish.

Sign in to reply to this post
loading

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...