Problems, need help? Have a tip or advice? Post it here.
26 posts Page 1 of 3
Hei Guys,

I have been having problems setting up a filterable photo gallery that is part of a One-page (parallax) website.
So far, I have created a separate page, gallery.php as per the instructions in the tutorials and eventually been able to create folders that i have in return uploaded relevant images into. The gallery features isotope filtering with three different categories. No subfolders. That is, All, Boys, Girls, and Others.

The code in the gallery.php is as follows:

Code: Select all
<?php require_once( 'couch/cms.php' ); ?>
<cms:template title='Gallery' clonable='1' dynamic_folders='0' gallery='1'>
         <!-- filters -->
  <cms:folder name="beauty" title="girls" />
  <cms:folder name="theatre" title="boys" />
  <cms:folder name="various" title="various" />
     
   <cms:editable
      name="gg_image"
      label="Image"
      desc="Preview image"
      height="800"
      show_preview='1'
      preview_height='200'
      type="image"
   />

   <cms:editable
      name="gg_thumb"
      assoc_field="gg_image"
      label="Image Thumbnail"
      desc="Thumbnail image"
      width='115'
      height='115'
      enforce_max='1'
      type="thumbnail"
   />
   <cms:editable
    name        = 'grid_thumb'
    assoc_field = 'gg_image'
    label       = 'Grid Thumbnail Image'
    desc        = 'Thumbnail Image'
    width       = '420'
    height      = '320'
    crop        = '1'
    type        = 'thumbnail'
/>
   
    <cms:editable
      name='image_desc'
      label='Description'
      height='40'
      type='textarea'
   />
     
     <cms:editable
      name='project_designer'
      label='Designer Name'
      height='40'
      type='richtext'
   />
</cms:template>
<?php COUCH::invoke(); ?>


I am not certain where I am going wrong because as much as the Admin section seems functional and OK, i cannot be able to make the filters work (the folder names are visible in the front-end). In short, displaying the gallery in the front-end and making the filters work is the main concern.

Here is the code from the index.php (main page):

Code: Select all
<?php require_once( 'couch/cms.php' ); ?>
<cms:template title='Main Pages' >
   <! -------- -->
</cms:template>
<html>
<body>
    <! -- content from various sections of the website -->

<!-- portfolio -->
<div id="portfolio" class="sections ws">
     <div class="content">
     <div class="quote-icon"><i class="fa fa-suitcase fa-2x"></i></div>
     <div class="container grid1">
      <h3 class="sections-head">Portfolio</h3>
      <h2>My work</h2>      
      <div class="small-separator"></div>   
     </div>
     <div id="options" class="clear">                              
           <ul id="filters" class="option-set" data-option-key="filter">
                     <li class="filter actcat"><a href="#" data-filter="*">All</a></li>
                      <cms:folders masterpage='gallery.php' hierarchical='1' depth='1'>
                      <li class="filter">
                          <a href="#" data-filter=".folder<cms:show k_folder_name />"></a>
           <cms:show k_folder_name />
                      </li>
                     </cms:folders>
                   </ul>   
          </div>                           
          <div class="aih">
          <ul id="folio_container" class="grid-full animaper">
          <cms:pages masterpage='gallery.php' include_subfolders='1' >      
          <li class="box  mix mix_all folder-<cms:show k_page_folder_name /> all">      
            <a href="<cms:show gg_image />" data-rel="prettyPhoto[gallery] class="respimg"
                                alt="<cms:show k_folder_title />">
                <img src="<cms:show grid_thumb />" alt="<cms:show k_folder_title />">   
                 <div class="folio-name clear">
                    <div class="folio-overlay">
                        <span class="overlay red"></span>
                        <h4><cms:show project_designer /></h4>                     
                   <h6><cms:show k_folder_name /></h6>
               </div>
                 </div>
              </a>
                         </li>
         </cms:pages>      
           </ul>
             </div>
          </div>
   </div>      
   <!-- end portfolio -->
  </body>
</html>
<?php COUCH::invoke(); ?>


Any assistance would be highly appreciated.
Thanks.
Hi :)

First, fix the typo here (missed quotes)
data-rel="prettyPhoto[gallery] class="respimg"

Next, if it's still not working, view source and find if anything is missed.
Join COUCH:TALK channel here https://t.me/couchcms_chat
Ryazania — a framework to boost productivity with Add-ons viewtopic.php?f=2&t=13475
Support my efforts to help the community https://boosty.to/trendo/donate
Thanks for taking the time to reply trendoman. :D

I did correct the typo, (missing quote mark).

Unfortunately, it didn't solve the issue though I was partially able to pull some sort of very tiny thumbnails (which are barely visible - they are like tiny dots) which upon clicking, they are able to preview the Image itself.

The filter does not work at all.

I have a feeling that the code itself is kinda okay?
Can you test it with static data? I mean, make a temporary copy of your html with manually placed images etc - will it work correctly? Then part by part change to couch-served data and see where is the trouble ;)
Join COUCH:TALK channel here https://t.me/couchcms_chat
Ryazania — a framework to boost productivity with Add-ons viewtopic.php?f=2&t=13475
Support my efforts to help the community https://boosty.to/trendo/donate
I have tried previewing the page in static mode and the images seem to be previewing well, though when i start placing the couch-served data, the images suddenly disappear.

Any more ideas? I would hugely appreciate it? And what about, the code that i posted earlier? Is it correct? or do you suppose the conflict is within my stylesheets?

Again, thanks.
If manually placed images are previewing well, then it's not stylesheets, i guess?
How about this piece - is it working fine with all the rest static data?
Code: Select all
 <ul id="filters" class="option-set" data-option-key="filter">
                     <li class="filter actcat"><a href="#" data-filter="*">All</a></li>
                      <cms:folders masterpage='gallery.php' hierarchical='1' depth='1'>
                      <li class="filter">
                          <a href="#" data-filter=".folder<cms:show k_folder_name />"></a>
           <cms:show k_folder_name />
                      </li>
                     </cms:folders>
                   </ul> 


If it does work good, then we can move on the next piece and actually find the difference between browser's manual source and generated source (view source on page). Can you try to spot any differences there?

Actually, the code you posted seems fine. What really is interesting is to find the reason for
the images suddenly disappear.
So, I don't think we need any more ideas here, besides meticulous reading of generated html and comparing it with manual html which works in order to find the problem.
Join COUCH:TALK channel here https://t.me/couchcms_chat
Ryazania — a framework to boost productivity with Add-ons viewtopic.php?f=2&t=13475
Support my efforts to help the community https://boosty.to/trendo/donate
Sorry I took longer to reply.

I did try using the code for the filter with the static images but unfortunately, it didn't work.

I went ahead and viewed the source code and tried to change certain elements in the console, for instance, opacity:1; , display:inline-block; , height:320px; etc, but it didn't really help. As i mentioned, the preview works perfectly as i am able to see the respective preview image.

I feel that the thumbnail images in the folders are not being targeted? though i may be wrong?
In fact, the src="" target is blank as seen in the source code. This is the code from console viewi:
Code: Select all
<a href="http://localhost/kajoe14/couch/uploads/image/gallery/boys-pics.jpg" data-rel="prettyPhoto[gallery]" class="respimg" alt="" style="opacity: 1; top: 0px;">
<img src="" alt="">   
<div class="folio-name clear">
    <div class="folio-overlay">   
      <span class="overlay red"></span>   
          <h4><p>Kajoe14</p></h4>
          <h6></h6>   
      </div>
    </div>
</a>


I also want to assume thats probably why the filters don't work, because they are not targeting the correct folder thumbnail. I happen to have the images in three different folders in the admin panel, that is, Boys, Girls, Various. I assumed that the thumbs would fetched through:
Code: Select all
<a href="http://localhost/kajoe14/couch/uploads/image/gallery/boys/boys-pics.jpg" data-rel="prettyPhoto[gallery]" class="respimg" alt="" style="opacity: 1; top: 0px;">
<img src="" alt="">   the src is empty from this


Again, thanks for all the assistance so far.
Ok, now we see the problematic piece of code and can work with it.
<img src="<cms:show grid_thumb />" alt="<cms:show k_folder_title />">


I see, that images are fetched by cms:pages, your code is correct. One nuance is that alt="" will be empty, because you fetch pages, not folders and <cms:show k_folder_title /> should be replaced by code with another system variable, showing name of the folder of the page. Correct variable can be seen with <cms:dump />:
Code: Select all
<cms:pages masterpage='gallery.php' include_subfolders='1' >   
      <cms:dump />
</cms:pages>

Please run the snippet above in any place of your template and you will see listing of each image and all available data for each. You'll then be able to see where folder name/title is stored AND, more importantly, if grid_thumb appears in that list. If it appears, then what value it has. I suspect, that grid_thumb is either non-present or empty.

Therefore the problem is with gallery.php and possibilities are: not updated editables with super-admin, not created thumbnails, because grid_thumb was placed *after* images were uploaded and therefore it didn't create thumbs and other similar and easy to resolve things.
Join COUCH:TALK channel here https://t.me/couchcms_chat
Ryazania — a framework to boost productivity with Add-ons viewtopic.php?f=2&t=13475
Support my efforts to help the community https://boosty.to/trendo/donate
That actually helped.

The problem was because, '' grid_thumb was placed *after* images were uploaded and therefore it didn't create thumbs and other similar and easy to resolve things. ''

I thus deleted all the images and re-uploaded them in their respective folders.

The only problem I have right now is with the filters. They don't work.
Plus the thumbnails do not seem to follow the size dimensions i had earlier set.
Code: Select all
   <cms:editable
    name        = 'grid_thumb'
    assoc_field = 'gg_image'
    label       = 'Grid Thumbnail Image'
    desc        = 'Thumbnail Image'
    width       = '420'
    height      = '320'
    enforce_max = '1'
    type        = 'thumbnail'
/>


@trendoman: I honestly appreciate all the effort you've put to get me this far with your assistance.
You are welcome :)

the thumbnails do not seem to follow the size dimensions i had earlier set.

What is expected and what you got? If you want to have *exact* size then crop='1' is of course better than enforce_max.

I am glad that you found the source of trouble. I see that the number of images is not huge, that's why it is fine to delete and re-upload. Removing url from gg_image field, saving page and placing url back and saving also works. There was a script to automate those operations on forum, if you ever need it.

the filters. They don't work.

Sometimes, it is connected to proper choosing what to use with filter names - folder name or folder title. Again, the process is the same - compare with static working variant and make output of cms:folders or cms:pages match.
Join COUCH:TALK channel here https://t.me/couchcms_chat
Ryazania — a framework to boost productivity with Add-ons viewtopic.php?f=2&t=13475
Support my efforts to help the community https://boosty.to/trendo/donate
26 posts Page 1 of 3