Forum for discussing general topics related to Couch.
19 posts Page 1 of 2
Hello

Is it possible to add an editable text area to this page, and to only display the gallery if it has images?

Code: Select all
<?php require_once( 'admin/cms.php' ); ?>

<cms:template title='Gallery' clonable='1' dynamic_folders='1' gallery='1'>
   <cms:editable name='gg_image' label='Image' desc='Upload your main image here' width='640' height='640' show_preview='1' preview_height='200' type='image' />
   <cms:editable name='gg_thumb' label='Image Thumbnail' desc='Thumbnail of the main image above' width='300' height='300' enforce_max='1' assoc_field='gg_image' show_preview='1' type='thumbnail' />
   <cms:editable name='my_thumb_2' label='Image Thumbnail 2' desc='Second thumbnail of the main image above' width='300' height='300' assoc_field='gg_image' show_preview='1' type='thumbnail' />
</cms:template>

<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>Photo Gallery | <cms:get_custom_field 'site_name' masterpage='globals.php' /></title>
<meta name="description" content="<cms:get_custom_field 'site_desc' masterpage='globals.php' />">

<!-- header HTML -->
<cms:get_custom_field 'head_html' masterpage='globals.php' />
<!-- -->

<style type="text/css">
/*
Paginator -
Source: http://www.strangerstudios.com/sandbox/pagination/diggstyle.php (strangerstudios.com)
*/
div.pagination {
   padding: 3px;
   margin: 3px;
}
div.pagination a {
   padding: 2px 5px 2px 5px;
   margin: 2px;
   border: 1px solid #666;
   zoom: 100%;
   text-decoration: none; /* no underline */
   color: #666;
}
div.pagination a:hover, div.pagination a:active {
   border: 1px solid #000;
   color: #000;
}
div.pagination span.page_current {
   padding: 2px 5px 2px 5px;
   margin: 2px;
   border: 1px solid #666;
* zoom: 100%;
   font-weight: bold;
   background-color: #666;
   color: #FFF;
}
div.pagination span.page_disabled {
   display: none;
}
* span.elipsis {
   zoom: 100%
}
</style>

</head>
<body>

<!-- body html 1 -->
<cms:get_custom_field 'body_html1' masterpage='globals.php' />
<!-- -->

<!-- menu code -->
<cms:nested_pages masterpage='index.php' extended_info='1' ><cms:if k_level_start ><cms:if k_level='0'><ul><cms:else /><ul class="dropdown-menu" role="menu"></cms:if></cms:if><cms:if k_element_start ><cms:if k_level='0'><li class="dropdown"><cms:else /><li class="sm"></cms:if><a href="<cms:show k_menu_link />" title="<cms:show k_menu_title />"><cms:show k_menu_title /></a></cms:if><cms:if k_element_end ></li></cms:if><cms:if k_level_end ></ul></cms:if></cms:nested_pages>
<!-- -->

<!-- body html 2-->
<cms:get_custom_field 'body_html2' masterpage='globals.php' />
<!-- -->

<!-- gallery code -->
<div id="gallery-wrapper">
   <div id="breadcrumbs">
      <h1><cms:breadcrumbs separator='' include_template='1'/></h1>
      <cms:if k_is_page>
         <h3><cms:show k_page_title /></h3>
      </cms:if>
   </div>
   <cms:if k_is_list >
      <cms:ignore> NOTE: A few points to note about the way folders are displayed -
         
         1. We display only the immediate child folders of the current folder (root is also considered a folder). If the images in the current folder are numerous enough to need pagination, we take care to display the folders only on the first page.
         
         2. If the folder has an image associated with it (via the 'Manage folders' admin section), that image is used. If no image is associated, we pick up the first page contained within this folder and use its thumbnail. Finally if there are no child pages within, we use a default folder icon. </cms:ignore>
      <cms:set my_page="<cms:gpc 'pg' method='get' />" />
      <cms:if my_page lt '2' >
         <div class="gallery">
            <cms:folders childof=k_folder_name hierarchical='1' depth='1'>
               <cms:set my_folder_image="" />
               <cms:if k_folder_image>
                  <cms:set my_folder_image=k_folder_image />
                  <cms:else />
                  <cms:pages folder=k_folder_name include_subfolders='0' limit='1'>
                     <cms:set my_folder_image=my_thumb_2 scope='parent' />
                  </cms:pages>
               </cms:if>
               <cms:if my_folder_image=''>
                  <cms:set my_folder_image="<cms:show k_admin_link />theme/images/empty-folder.gif" />
               </cms:if>
               <a class="fancybox" href="<cms:show k_folder_link />" data-fancybox-group="gallery"><img alt="<cms:show k_folder_title />" src="<cms:show my_folder_image />"/> <span class="title">
                  <cms:show k_folder_title />
                  </span> <span class="count_images">
                  <cms:show k_folder_totalpagecount />
                  images</span> <span class="count_folders">
                  <cms:show k_folder_totalchildren />
                  folders</span></a>
            </cms:folders>
         </div>
      </cms:if>
      <div class="gallery">
         <cms:pages folder=k_folder_name include_subfolders='0' limit='18' paginate='1'>
            <a class="fancybox" href="<cms:show gg_image />" data-fancybox-group="gallery"><img alt="<cms:show k_page_title />" src="<cms:show my_thumb_2 />"/></a>
            <cms:if k_paginated_bottom >
               <div style="clear:both">
                  <cms:paginator />
               </div>
            </cms:if>
         </cms:pages>
      </div>
      <cms:else />
      <div id="image_container"><img alt="<cms:show k_page_title />" src="<cms:show gg_image />"/></div>
   </cms:if>
</div>
<!-- -->

<!-- footer content -->
<cms:get_custom_field 'footer_html' masterpage='globals.php' />
<!-- -->

</body>
</html>

<?php COUCH::invoke(); ?>


Kind Regards
Nick
Hi,

Not sure if I understood the question fully but I'll try to answer -
Is it possible to add an editable text area to this page
Of course. It is an ordinary template and you can define as many editable regions as you wish. The method remains the same as with all other templates.

and to only display the gallery if it has images?
One way of doing that would be by not showing the folder icon for the folders that are empty. Can do that by wrapping the existing display code in a check for child pages -
Code: Select all
<cms:folders childof=k_folder_name hierarchical='1' depth='1'>
    <cms:if k_folder_totalpagecount >
        .. existing code ..
    </cms:if>
</cms:folders>

Hope it helps.
Hello

I've added a content area, but it's not showing up in admin?

Code: Select all
<?php require_once( 'admin/cms.php' ); ?>

<cms:template title='Gallery' clonable='1' dynamic_folders='1' gallery='1'>
   <cms:editable name='main_content' label='Main Content' type='textarea' />
   <cms:editable name='gg_image' label='Image' desc='Upload your main image here' width='640' height='640' show_preview='1' preview_height='200' type='image' />
   <cms:editable name='gg_thumb' label='Image Thumbnail' desc='Thumbnail of the main image above' width='300' height='300' enforce_max='1' assoc_field='gg_image' show_preview='1' type='thumbnail' />
   <cms:editable name='my_thumb_2' label='Image Thumbnail 2' desc='Second thumbnail of the main image above' width='300' height='300' assoc_field='gg_image' show_preview='1' type='thumbnail' />
</cms:template>

<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>Photo Gallery | <cms:get_custom_field 'site_name' masterpage='globals.php' /></title>
<meta name="description" content="<cms:get_custom_field 'site_desc' masterpage='globals.php' />">

<!-- header HTML -->
<cms:get_custom_field 'head_html' masterpage='globals.php' />
<!-- -->

<style type="text/css">
/*
Paginator -
Source: http://www.strangerstudios.com/sandbox/pagination/diggstyle.php (strangerstudios.com)
*/
div.pagination {
   padding: 3px;
   margin: 3px;
}
div.pagination a {
   padding: 2px 5px 2px 5px;
   margin: 2px;
   border: 1px solid #666;
   zoom: 100%;
   text-decoration: none; /* no underline */
   color: #666;
}
div.pagination a:hover, div.pagination a:active {
   border: 1px solid #000;
   color: #000;
}
div.pagination span.page_current {
   padding: 2px 5px 2px 5px;
   margin: 2px;
   border: 1px solid #666;
* zoom: 100%;
   font-weight: bold;
   background-color: #666;
   color: #FFF;
}
div.pagination span.page_disabled {
   display: none;
}
* span.elipsis {
   zoom: 100%
}
</style>

</head>
<body>

<!-- body html 1 -->
<cms:get_custom_field 'body_html1' masterpage='globals.php' />
<!-- -->

<!-- menu code -->
<cms:nested_pages masterpage='index.php' extended_info='1' ><cms:if k_level_start ><cms:if k_level='0'><ul><cms:else /><ul class="dropdown-menu" role="menu"></cms:if></cms:if><cms:if k_element_start ><cms:if k_level='0'><li class="dropdown"><cms:else /><li class="sm"></cms:if><a href="<cms:show k_menu_link />" title="<cms:show k_menu_title />"><cms:show k_menu_title /></a></cms:if><cms:if k_element_end ></li></cms:if><cms:if k_level_end ></ul></cms:if></cms:nested_pages>
<!-- -->

<!-- body html 2-->
<cms:get_custom_field 'body_html2' masterpage='globals.php' />
<!-- -->

<!-- gallery code -->
<div id="gallery-wrapper">
      <cms:if k_is_page>
         <h3><cms:show k_page_title /></h3>
      </cms:if>
      <cms:if k_is_list >   
      <cms:set my_page="<cms:gpc 'pg' method='get' />" />
      <cms:if my_page lt '2' >
      <!-- main content -->
      <cms:show main_content />
      <!-- -->
         <div class="gallery">
            <cms:folders childof=k_folder_name hierarchical='1' depth='1'>
             <cms:if k_folder_totalpagecount >
               <cms:folders childof=k_folder_name hierarchical='1' depth='1'>
                  <cms:set my_folder_image="" />
                  <cms:if k_folder_image>
                     <cms:set my_folder_image=k_folder_image />
                     <cms:else />
                     <cms:pages folder=k_folder_name include_subfolders='0' limit='1'>
                        <cms:set my_folder_image=my_thumb_2 scope='parent' />
                     </cms:pages>
                  </cms:if>
                  <cms:if my_folder_image=''>
                     <cms:set my_folder_image="<cms:show k_admin_link />theme/images/empty-folder.gif" />
                  </cms:if>
                  <a class="fancybox" href="<cms:show k_folder_link />" data-fancybox-group="gallery"><img alt="<cms:show k_folder_title />" src="<cms:show my_folder_image />"/> <span class="title">
                     <cms:show k_folder_title />
                     </span> <span class="count_images">
                     <cms:show k_folder_totalpagecount />
                     images</span> <span class="count_folders">
                     <cms:show k_folder_totalchildren />
                     folders</span></a>
               </cms:folders>
                </cms:if>
            </cms:folders>
         </div>
      </cms:if>
      <div class="gallery">
         <cms:pages folder=k_folder_name include_subfolders='0' limit='18' paginate='1'>
            <a class="fancybox" href="<cms:show gg_image />" data-fancybox-group="gallery"><img alt="<cms:show k_page_title />" src="<cms:show my_thumb_2 />"/></a>
            <cms:if k_paginated_bottom >
               <div style="clear:both">
                  <cms:paginator />
               </div>
            </cms:if>
         </cms:pages>
      </div>
      <cms:else />
      <div id="image_container"><img alt="<cms:show k_page_title />" src="<cms:show gg_image />"/></div>
   </cms:if>
</div>
<!-- -->

<!-- footer content -->
<cms:get_custom_field 'footer_html' masterpage='globals.php' />
<!-- -->

</body>
</html>

<?php COUCH::invoke(); ?>
I've added a content area, but it's not showing up in admin?

Please see viewtopic.php?f=4&t=8059
Followed the instructions you provided and have come to the conclusion that perhaps something is wrong with the way I have coded the template :-(

Code: Select all
<?php require_once( 'admin/cms.php' ); ?>

<cms:template title='Gallery' clonable='1' dynamic_folders='1' gallery='1'>
   <cms:editable name='main_content' label='Main Content' type='textarea' />
   <cms:editable name='gg_image' label='Image' desc='Upload your main image here' width='640' height='640' show_preview='1' preview_height='200' type='image' />
   <cms:editable name='gg_thumb' label='Image Thumbnail' desc='Thumbnail of the main image above' width='300' height='300' enforce_max='1' assoc_field='gg_image' show_preview='1' type='thumbnail' />
   <cms:editable name='my_thumb_2' label='Image Thumbnail 2' desc='Second thumbnail of the main image above' width='300' height='300' assoc_field='gg_image' show_preview='1' type='thumbnail' />
</cms:template>

<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>Photo Gallery | <cms:get_custom_field 'site_name' masterpage='globals.php' /></title>
<meta name="description" content="<cms:get_custom_field 'site_desc' masterpage='globals.php' />">

<!-- header HTML -->
<cms:get_custom_field 'head_html' masterpage='globals.php' />
<!-- -->

<style type="text/css">
/*
Paginator -
Source: http://www.strangerstudios.com/sandbox/pagination/diggstyle.php (strangerstudios.com)
*/
div.pagination {
   padding: 3px;
   margin: 3px;
}
div.pagination a {
   padding: 2px 5px 2px 5px;
   margin: 2px;
   border: 1px solid #666;
   zoom: 100%;
   text-decoration: none; /* no underline */
   color: #666;
}
div.pagination a:hover, div.pagination a:active {
   border: 1px solid #000;
   color: #000;
}
div.pagination span.page_current {
   padding: 2px 5px 2px 5px;
   margin: 2px;
   border: 1px solid #666;
* zoom: 100%;
   font-weight: bold;
   background-color: #666;
   color: #FFF;
}
div.pagination span.page_disabled {
   display: none;
}
* span.elipsis {
   zoom: 100%
}
</style>

</head>
<body>

<!-- body html 1 -->
<cms:get_custom_field 'body_html1' masterpage='globals.php' />
<!-- -->

<!-- menu code -->
<cms:nested_pages masterpage='index.php' extended_info='1' ><cms:if k_level_start ><cms:if k_level='0'><ul><cms:else /><ul class="dropdown-menu" role="menu"></cms:if></cms:if><cms:if k_element_start ><cms:if k_level='0'><li class="dropdown"><cms:else /><li class="sm"></cms:if><a href="<cms:show k_menu_link />" title="<cms:show k_menu_title />"><cms:show k_menu_title /></a></cms:if><cms:if k_element_end ></li></cms:if><cms:if k_level_end ></ul></cms:if></cms:nested_pages>
<!-- -->

<!-- body html 2-->
<cms:get_custom_field 'body_html2' masterpage='globals.php' />
<!-- -->

<!-- gallery code -->
<div id="gallery-wrapper">
      <cms:if k_is_page>
         <h3><cms:show k_page_title /></h3>
      </cms:if>
      <cms:if k_is_list >   
      <cms:set my_page="<cms:gpc 'pg' method='get' />" />
      <cms:if my_page lt '2' >

      <!-- debugging -->
      <cms:if k_user_access_level ge '10' >
        <p><a target="_blank" href="<cms:admin_link />">EDIT</a></p>
      <cms:else /> 
        <h3>You cannot edit!</h3>
      </cms:if>
      <!-- -->

      <!-- main content -->
      <cms:show main_content />
      <!-- -->
         <div class="gallery">
            <cms:folders childof=k_folder_name hierarchical='1' depth='1'>
             <cms:if k_folder_totalpagecount >
               <cms:folders childof=k_folder_name hierarchical='1' depth='1'>
                  <cms:set my_folder_image="" />
                  <cms:if k_folder_image>
                     <cms:set my_folder_image=k_folder_image />
                     <cms:else />
                     <cms:pages folder=k_folder_name include_subfolders='0' limit='1'>
                        <cms:set my_folder_image=my_thumb_2 scope='parent' />
                     </cms:pages>
                  </cms:if>
                  <cms:if my_folder_image=''>
                     <cms:set my_folder_image="<cms:show k_admin_link />theme/images/empty-folder.gif" />
                  </cms:if>
                  <a class="fancybox" href="<cms:show k_folder_link />" data-fancybox-group="gallery"><img alt="<cms:show k_folder_title />" src="<cms:show my_folder_image />"/> <span class="title">
                     <cms:show k_folder_title />
                     </span> <span class="count_images">
                     <cms:show k_folder_totalpagecount />
                     images</span> <span class="count_folders">
                     <cms:show k_folder_totalchildren />
                     folders</span></a>
               </cms:folders>
                </cms:if>
            </cms:folders>
         </div>
      </cms:if>
      <div class="gallery">
         <cms:pages folder=k_folder_name include_subfolders='0' limit='18' paginate='1'>
            <a class="fancybox" href="<cms:show gg_image />" data-fancybox-group="gallery"><img alt="<cms:show k_page_title />" src="<cms:show my_thumb_2 />"/></a>
            <cms:if k_paginated_bottom >
               <div style="clear:both">
                  <cms:paginator />
               </div>
            </cms:if>
         </cms:pages>
      </div>
      <cms:else />
      <div id="image_container"><img alt="<cms:show k_page_title />" src="<cms:show gg_image />"/></div>
   </cms:if>
</div>
<!-- -->

<!-- footer content -->
<cms:get_custom_field 'footer_html' masterpage='globals.php' />
<!-- -->

</body>
</html>

<?php COUCH::invoke(); ?>
Followed the instructions you provided and have come to the conclusion that perhaps something is wrong with the way I have coded the template :-(
I copied/pasted your exact template and checked it on my system - could see all the editable regions just fine.

So if the problem was that the new region was not showing up in the admin-panel, trust me there is nothing wrong in your code. Please take the time to ensure that you are visiting it as super-admin (can you see the 'edit' link mentioned in the post?).
Yes I can see the edit link
OK. But now I have nothing else to suggest.

PM me your site's Couch super-admin + FTP creds if you'd like me to take a look at the problem.
Thanks for the creds.

I had a look at the admin-panel and in the gallery section can see that the 'Main Content' editable region is clearly available (click on the 'default-page' to edit it).

So, I am confused - what is the exact problem you have?
Hello

Why doesn't the information from the editable area appear on the gallery page?

http://www.djnickburrett.com/gallery/
19 posts Page 1 of 2
cron