Problems, need help? Have a tip or advice? Post it here.
5 posts Page 1 of 1
Hello All...

I am trying to make a gallery. The gallery uses simple thumbnail display of images which are uploaded by repeatable regions in the backend. And to show the image enlarged i am using lightbox2. So each set of images are PAGES.

Now my requirement is that:
1. Dynamic Folders to create categories like, Birthday, Wedding, Pre-wedding, etc.
2. Each dynamic folder shall contain one or more pages. So if there is:
a. Single PAGE then its content, i.e. images, must be shown
b. Multiple PAGES then a list of all pages must be shown and when clicked (one of the multiple page) content of that PAGE must be shown.

So the Structure could be like:
#Birthday (Folder)
- Mr X B'Day (Page)
- Ms Y B'Day (Page)
#Wedding (Folder)
- Mrs & Mr Z Wedding (Page)
#Pre-Wedding (Folder)
- Mr A and Ms B Pre-wedding Shoot (Page)


When the Page loads, I want to show only the Folder.
When A Folder is clicked, It must display either all the pages in it (if there are multiple Pages in the folder) or display all the images on that page (if there was only one page in the folder)

Do i need to do this with the <cms:embed> as in the blog tutorial or by <cms:if k_is_folder>/ <cms:if k_is_page> tags?

Regards,
GenXCoders
Image
where innovation meets technology
Hi,

I think you can do that using the following (I am providing only pseudo-code as I am sure you'll manage to convert it to correct Couch code) -
Code: Select all
If home-view
    list all folders
elseif folder-view
   if folder has only one child page (find this using k_folder_pagecount variable)
      redirect to that child page
   else
      show a list of child pages
   endif
elseif page-view
    show images on page
endif

Hope it helps.
@KK Sir, This is what I have with a few blanks

Code: Select all
    <cms:if k_is_home>
    <!-- list all folders -->
    <ul>
        <cms:folders masterpage=k_tempalte_name>
        <li><a href="<cms:show k_folder_link />"><cms:show k_folder_title /></a></li>
        </cms:folders>
    </ul>         
    <!-- list all folders -->
    <cms:else_if k_is_folder />
        <!-- if folder has only one child page (find this using k_folder_pagecount variable) -->
        <cms:if k_folder_pagecount='0'>
            redirect to that child page
            <!-- if folder has only one child page (find this using k_folder_pagecount variable) -->
        <cms:else />
            <!-- show a list of child pages -->
            <cms:pages masterpage=k_template_name folder=k_folder_name>
                <a href='<cms:show k_page_link />'><cms:show k_page_title /></a>
            </cms:pages>
            <!-- show a list of child pages -->
        </cms:if>
    <cms:else_if k_is_page />
        <!-- show images on page -->
        <cms:pages masterpage='folder-page-test.php'>
            <img src='<cms:show pic_1 />' />
            <img src='<cms:show pic_2 />' />
        </cms:pages>
        <!-- show images on page -->
    </cms:if>


What i could not figure out was how to redirect and though i reach the page view, I get a blank page.

Regards,
GenXCoders
Image
where innovation meets technology
I think the following should work -
Code: Select all
<cms:if k_is_home>
    <!-- list all folders -->
    <ul>
        <cms:folders masterpage=k_template_name>
        <li><a href="<cms:show k_folder_link />"><cms:show k_folder_title /></a></li>
        </cms:folders>
    </ul>         
<cms:else_if k_is_folder />
    <!-- if folder has only one child page (find this using k_folder_pagecount variable) -->
    <cms:if k_folder_pagecount='1'>
        <!-- redirect to that child page -->
        <cms:pages masterpage=k_template_name folder=k_folder_name>
            <cms:redirect k_page_link />
        </cms:pages>
    <cms:else />
        <!-- show a list of child pages -->
        <cms:pages masterpage=k_template_name folder=k_folder_name>
            <a href="<cms:show k_page_link />"><cms:show k_page_title /></a>
        </cms:pages>
    </cms:if>
<cms:else_if k_is_page />
    <!-- show images on page -->
    <h1><cms:show k_page_title /></h1>

    <img src="<cms:show pic_1 />" />
    <img src="<cms:show pic_2 />" />
</cms:if>
@KK Sir,
Thanks a lot it works great.
Image
where innovation meets technology
5 posts Page 1 of 1
cron