close ad
WARNING: Do Not Install the DREAMWEAVER CC 2017 Update »
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Help with nested repeat region

Thread began 6/16/2013 9:52 am by iainmacdonald331081 | Last modified 6/18/2013 2:16 pm by CraigR | 1286 views | 9 replies |

iainmacdonald331081

Help with nested repeat region

I've been playing around with this for a while, but haven't been able to get it right. Have been looking at DA's repeating table and Tom Muck's nested region behaviour, but haven't got it to work with either. Plus I'm a little unsure if I need one or two SQL queries.

Anyway, this is the page that is closest, but has no nested repeat applied:

http://www.goodsafariguide.net/itineraries_beta/index501.php

Basically where there are two instances of 'Test Itinerary' (one for each of Tanzania and Kenya), I just want one instance to list Tanzania and Kenya together.

The table structure is:

Tables:

Itineraries
ItineraryID, Itinerary etc

activities
ActivityID, Activity, etc

ItineraryActivities
ItineraryID, ActivityID

And currently one SQL query:

SELECT * FROM itineraries INNER JOIN ItineraryActivities ON ItineraryActivities.ItineraryID = itineraries.ItineraryID INNER JOIN activities ON activities.ActivityID = ItineraryActivities.ActivityID WHERE Publish_GSG = 'Yes' AND Category_Order = 1

(Category_Order refers to countries in the activities table)

Basically I just need this code to repeat:

<table>
<tr>
<td><img src="../../itinerary_resources/icons/<?php echo $row_SecurityAssisttradeusers['Icon']; ?>" width="30" height="20" alt="Country Flag" /></td>
<td><h2><?php echo $row_SecurityAssisttradeusers['Activity']; ?></h2></td>
</tr>
</table>



Rather than it display duplicate entries for itineraries where more than one country is linked to the itinerary.

Hope that makes sense - I've attached a copy of that file.

Thanks,

Sign in to reply to this post

CraigRBeta Tester

take a look at this thread.

http://cookbooks.adobe.com/post_Create_nested_lists_from_a_recordset__PHP_-16720.html

I have used this approach a number of times and it is quite straightforward once you get familiar with it, and it shows how to do it with tables and lists.

You only need one recordset, just ensure your data is ordered correctly.

What you are doing is looking at the value of the field which is repeated, if it is the different the previous one, display it, otherwise skip it.

Sign in to reply to this post

iainmacdonald331081

Thanks Craig,

Someone has been helping out somewhere else with the SQL, and almost got it working using this SQL:

SELECT itineraries.ItineraryID
, itineraries.Itinerary
,itineraries.ItineraryID
, itineraries.Itinerary
, itineraries.Summary
, itineraries.Currency
, itineraries.Price
, itineraries.Duration
, itineraries.Publish_GSG
, itineraries.Image3
, GROUP_CONCAT(
CONCAT_WS(':',activities.icon)
SEPARATOR '<br />'
)
AS flags
, GROUP_CONCAT(
CONCAT_WS(':',activities.activity)
SEPARATOR '<br />'
)
AS countries
FROM itineraries
INNER JOIN ItineraryActivities
ON ItineraryActivities.ItineraryID = itineraries.ItineraryID
INNER JOIN activities
ON activities.ActivityID = ItineraryActivities.ActivityID
AND activities.Category = 'Countries Visited'
WHERE itineraries.Publish_GSG = 'Yes'
GROUP
BY itineraries.ItineraryID

Which works here:

http://www.goodsafariguide.net/itineraries_beta/index801.php

But something goes AWOL when I try to display the little flag icons - it only displays them if there is only one country listed, which seems weird as the text from the field is displaying correctly above.

http://www.goodsafariguide.net/itineraries_beta/index802.php

Will have a look at your link and see how I go with that.

Sign in to reply to this post

iainmacdonald331081

Not sure if I'm doing something wrong (probably!) or that's how its supposed to work, but I've only gotten as far it listing the first itinerary with the countries for all the itineraries, like this:

http://www.goodsafariguide.net/itineraries_beta/index901.php

So I think 801 and 802 above are the closest I've got.

I think I understand why 802 isn't working, as the IMG tag to look up the image filename in the 'flag' field isn't repeating, I'm just not sure how to fix it.

Sign in to reply to this post

CraigRBeta Tester

PM

Sign in to reply to this post

iainmacdonald331081

Thanks Craig. I have been doing a little more, so some versions probably got out of whack.

The 801 and 802 are now 901 and 902:

itijneraries_beta901.php

itijneraries_beta902.php

PM below.

Sign in to reply to this post

iainmacdonald331081

Also, I meant to say, with the link here:

http://cookbooks.adobe.com/post_Create_nested_lists_from_a_recordset__PHP_-16720.html

I meant to ask, is that two solutions depending on situation, or one?

ie is the part up until 'Creating nested lists' for one scenario, and the bit below for another scenario?

That probably sounds dumb, but my brain is a bit fried from looking at so many different variations on this over the last couple of days!

Sign in to reply to this post

CraigRBeta Tester

pm

Sign in to reply to this post

iainmacdonald331081

pm

Sign in to reply to this post

CraigRBeta Tester

pm

seems like i can;t see the attachment on this thread for some reason, will enquir with WA

Problem sorted using a nested recordset

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...