Problems, need help? Have a tip or advice? Post it here.
4 posts Page 1 of 1
Hello and Happy New Year to all!

I am having a mini crisis of confidence here - I think I should be able to work this out!

I have a non-cloneable template called meet-the-choir.php with just one editable region - feature_introduction. I also have a cloneable template called profiles.php which consists of member_photo and member_biography.

On first arriving on the meet-the-choir page I want to display the feature_introduction (from meet-the-choir.php) in the right column and show a list of thumbnail links to the cloned pages i.e. member_photo from profiles.php.

When a thumbnail link is clicked I want to replace feature_introduction and display member_photo and member_biography in the right column whilst leaving the thumbnail links in place as navigation in the left column.

A pointer in the right direction would be hugely appreciated!
A very happy new year to you too, potato :)

If I understood it right, there can be 3 different ways of handling this situation -
1. If the number of members is not too high, in meet-the-choir.php loop through all the members and store the info in a JavaScript array. On the front-end, JS could very easily replace the contents according to the thumbnail clicked.

2. If the number of members is too large to be fetched in one fell swoop, use a second AJAX template. Invoke it through JS with the member page-id and then use the passed id (get by using cms:gpc tag) in cms:pages tag to get and pass back only that particular member's info.

3. Finally, instead of a second template (as in the 2nd method above), use a querystring parameter with the meet-the-choir.php itself i.e. make clicking on a thumbnail call the same template but this time with an added parameter of the member-id.
Generate the right column according to the id passed (if no id passed, output the default 'feature_introduction'). This method does not involve JS and hence might appeal more.

There may me more ways of handling this but these three came to my mind immediately (cheesypoof might want to add some more to these).
Hope this helps. Do let me know.
Happpy New Year :)

I would probably choose KK's option 3 and a JavaScript method. This way people (and search engines) without JS will still be able to view the different member details and people with JS will benefit from not having to wait for numerous page reloads. Ultimately though as KK said, which JavaScript method (AJAX vs non-AJAX) is best depends on the number of members per page and how large these biographies are.
Code: Select all
<cms:if "<cms:gpc 'id' method='get'/>">
   <cms:pages masterpage='profiles.php' id="<cms:gpc 'id' method='get'/>">
      <img src="<cms:show member_photo/>">
      <cms:show member_biography/>
   </cms:pages>
   <cms:else/>
   <cms:show feature_introduction/>
</cms:if>
Many thanks for your replies. I had thought there would be a solution based on templates and views - so was clearly barking up the wrong tree (or I didn't explain the objective clearly enough). The number of profiles would be less than 100. Here is a rough sketch of the page:
profiles.gif
profiles.gif (5.1 KiB) Viewed 2352 times


I have been mulling this over and now have an idea to approach this in a different (simpler) way. I will create a single cloneable template - profiles.php - forget meet-the-choir.php. The very first cloned page will show the introductory blurb and is the default page shown on clicking to the page. The sub-nav listing of thumbnail links on the left will exclude the first cloned page. Site visitor selects a thumbnail, clicks and the profile of the choir member is shown.

I haven't used the gpc tag before - looks interesting. As usual, too much to do and too little time to do it!

Thanks again.
4 posts Page 1 of 1