Forum for discussing general topics related to Couch.
7 posts Page 1 of 1
Hello all. foa Couch is amazing!!
I can't believe I'm the only one asking about this, but I've read and read searched all the terms I can think of and there's nothing I can see that tells me what I need.

The easiest example to give here would be a portfolio or blog using the dynamic_folders='1' and gallery='1'.
Obviously that cannot be in the blog or portfolio template themselves, they would have to be their own template/folders (right?). Since gallery='1' is the only way to do the bulk upload of images, this is what I need.

But how do I match the blog (or portfolio) cloned page with the single photo gallery that would come from a dynamic gallery folder? I can connect them by editables (see code below)

I can't tell if I'm over-thinking or under-thinking...

On my portfolio.php template I have this editable:
Code: Select all
<cms:editable  name="gallery_folder" label="Choose Photo Gallery Page "  opt_values="gallery-listing.php" dynamic="opt_values" type="dropdown"  order='10' />


gallery-listing.php is just this:
Code: Select all
Please Select=-
<cms:folders masterpage='portfolio-gallery.php' >
    | <cms:show k_folder_title  /> = <cms:show k_folder_name />
</cms:folders>


Portfolio-gallery.php shows this:
Code: Select all
<cms:template parent='_portfolio_' title="Portfolio Gallery" clonable="1" hidden='0' dynamic_folders='1' gallery='1' >

and this works great!
for every gallery I make, the name shows up in a dropdown list in my portfolio clonable page.

Every portfolio-gallery folder has a main folder image and a description.
using <cms:pages... > I can enumerate everything I need including the value for the gallery_folder editable.

Where I'm stuck is that I'm unsure how to isolate the individual gallery folder to list out the single gallery folder image, text and of course the images that are ONLY in that folder. I can't find a way to have <cms:folders> only give me info on one single folder.

If this question has been answered, please my deepest apologies and just point me to that/those conversations. Or point me to the posts I've missed. I can't figure it out. Can this even be done? A specific photo gallery (dynamic..., gallery='1') enumerated from being tied to a clonable page? Also, as much as I believe this can probably be done with Page Builder, I'm working on a site that's already been configured before PB was available in Couch. I have to believe what I'm asking can be accomplished programmatically.
Hi :)

Although you seem to have devised a working solution using folders, could you please take a look at the following thread for an alternative solution? -
viewtopic.php?f=8&t=8559

If that can work for you, you won't have to store separate data for each folder (as that can be stored right in the main blog or portfolio cloned page).

Please check and let me know.
Well, I don't know if I'd call it a "working" solution, otherwise, I wouldn't be reaching out :lol:

Thank you so much KK for your quick response (and all that you do). Your kindness is appreciated immensely!
I can add an image to each portfolio template for sure. So, I guess you're saying there's really no way to isolate a folder that's not linked to a masterpage, even when an editable's value is the k_folder_name?
scratz wrote: Where I'm stuck is that I'm unsure how to isolate the individual gallery folder to list out the single gallery folder image, text and of course the images that are ONLY in that folder. I can't find a way to have <cms:folders> only give me info on one single folder.


Parameter folder of <cms:pages> is meant to exactly fetch cloned pages (images in 'gallery') from a certain folder, — see https://docs.couchcms.com/tags-reference/pages.html

A barebones test case —
Code: Select all
<cms:pages masterpage='portfolio.php'>
    <p>Portfolio item: <cms:show k_page_title />
    <!-- linked gallery listing follows -->
    <cms:pages masterpage='portfolio-gallery.php' folder=gallery_folder include_subfolders='1'>
        <cms:if k_paginated_top><ul></cms:if>
        <li><cms:show k_page_title /></li>
        <cms:if k_paginated_bottom></ul></cms:if>
    </cms:pages>
    </p>
</cms:pages>
I guess you're saying there's really no way to isolate a folder that's not linked to a masterpage, even when an editable's value is the k_folder_name?
Not at all.. knowing a folder's 'name' is sufficient to fetch all info about it and you already have that via the dynamically populated dropdown.

how to isolate the individual gallery folder to list out the single gallery folder image, text and of course the images that are ONLY in that folder
There are three separate items that you are looking to fetch.
@trendoman already showed above how to fetch the pages (i.e. gallery images in this case) from a single folder.
The two remaining are the image and description attached to that folder. This can be done by adding some code to @trendoman's solution which now becomes -
Code: Select all
<cms:pages masterpage='portfolio.php'>
    <p>Portfolio item: <cms:show k_page_title />
   
    <!-- image and description of the folder -->
    <cms:folders masterpage='portfolio-gallery.php' hierarchical='1' root=gallery_folder depth='1'>
        <!-- all data pertaining to this folder available here -->
        <cms:show k_folder_title /><br>
        <cms:show k_folder_image /><br>
        <cms:show k_folder_desc /><br>
    </cms:folders>
   
    <!-- linked gallery listing follows -->
    <cms:pages masterpage='portfolio-gallery.php' folder=gallery_folder include_subfolders='1'>
        <cms:if k_paginated_top><ul></cms:if>
        <li><cms:show k_page_title /></li>
        <cms:if k_paginated_bottom></ul></cms:if>
    </cms:pages>
    </p>
</cms:pages>

Please note the root=gallery_folder and depth='1' used with <cms:folders> tag above - that effectively isolates one single folder named as the root.

Does this help?
Thank you both very much!
.
KK's solution of <cms:pages> <cms:folder.... > is giving me the results I'm looking for. At some points in the enumeration the folder info is needed and as some, the page info is needed. I think the key I was missing is the 'root= parameter'.
The final code is below. The <pages> tag wraps around this somewhere else in the page. I'm not sure this is really a good way to code the page, but it's working. I may re-think it for overall for human readability.

Code: Select all
 
<div class="ch-item ch-item-hover" style='background: url("<cms:folders masterpage='portfolio-gallery.php' hierarchical='1' root=gallery_folder depth='1'><cms:show k_folder_image /></cms:folders>") no-repeat center;background-size:cover;'>
  <div class="ch-info">
    <div class="ch-info-icons">
      <a  href="<cms:folders masterpage='portfolio-gallery.php' hierarchical='1' root=gallery_folder depth='1'><cms:show k_folder_image />
     </cms:folders>" rel="lightbox" class="ch-info-lightbox" >
      <img src="images/icons/zoom.png" alt="Open Lightbox" />
      </a>
      <a href="<cms:show k_page_link />" >
          <img src="<cms:show k_site_link />images/icons/project.png" alt="" />
      </a>
    </div>
    <div class="ch-info-text">
      <p class="title"><cms:show k_page_title /></p>
      <p class="subtitle"><cms:each portfolio_categories sep='|'><cms:show item /> </cms:each></p>
     </div>
  </div>
</div>



Thank you both again very much for your time. Happy coding!
You are welcome :)
Glad we could help.
7 posts Page 1 of 1
cron