Problems, need help? Have a tip or advice? Post it here.
4 posts Page 1 of 1
I have a page called bikes that is clonable and I use this so my client can add new bikes to his site. I also create the dfropdown menu from these clonable pages by using
Code: Select all
<li class="dropdown">
<a href="#section4" >Rentals <b class="caret"></b></a>       
    <ul class="dropdown-menu">
   <cms:pages masterpage='bike.php' orderby='order'  order='asc'>
      <li><a href="<cms:show k_page_link />"><cms:show k_page_title /></a></li>
   </cms:pages>
     </ul>
</li>


Each bike page that is created needs an image gallery.

So using the photo gallery tutorial I have created a page called bike gallery and used the 'gg_image' gg_thumbnail' tags.

Now what I want is for there to be folders in the gallery page, with the name of the bike so the client can upload images of each bike to each folder and then only show those image on the relavant bike page.

But I need these folders to be created dynamically when the user adds a new bike.

I thought of this code to create the folders in the gallery page
Code: Select all
<cms:template title='Bike gallery' clonable='1' dynamci_folders='1' gallery='1'>

   <cms:editable name='gg_image'
            label='Image'
            desc='Upload your image here'
            width='500'
            show_preview='1'
            preview_height='200'
            type='image'
            />
   <cms:editable name='gg_thumb'
            assoc_field='gg_image'
            label='Image Thumbnail'
            desc='Thumbnail of image above'
            width='115'
            height='115'
            show_preview='1'
            enforce_max='1'
            type='thumbnail'
            />
   <cms:pages masterpage='bike.php'>
      <cms:folder name='<cms:show bike_make />' title='<cms:show bike_make />' />
   </cms:pages>
   
</cms:template>


but I am getting an error of 'ERROR: Name of folder contains invalid characters. (Only lowercase[a-z], numerals[0-9] hyphen and underscore permitted'

is there a way around this?
Hi Barry,

The reason for the error is that you are using single-quotes to wrap Couch tags -
<cms:folder name='<cms:show bike_make />' title='<cms:show bike_make />' />

It should be like this -
<cms:folder name="<cms:show bike_make />" title="<cms:show bike_make />" />

or simply this -
<cms:folder name=bike_make title=bike_make />

For a discussion on single vs double vs no quotes please see
http://www.couchcms.com/docs/concepts/s ... eters.html

That said, I see from your code that you are trying to loop through the bike pages and create folders corresponding to each bike.

There is a problem with this approach - you need to be logged-in as super-admin while executing this template for the folders to be created.
Also, whenever a new bike is added, you need to run this code afresh for the new folder to be created.

In short, the approach is not dynamic.

I suggest you please use the solution provided here for having a gallery per page -
viewtopic.php?f=8&t=8559

Hope this helps.
KK wrote: Hi Barry,

The reason for the error is that you are using single-quotes to wrap Couch tags -
<cms:folder name='<cms:show bike_make />' title='<cms:show bike_make />' />

It should be like this -
<cms:folder name="<cms:show bike_make />" title="<cms:show bike_make />" />

or simply this -
<cms:folder name=bike_make title=bike_make />

For a discussion on single vs double vs no quotes please see
http://www.couchcms.com/docs/concepts/s ... eters.html

That said, I see from your code that you are trying to loop through the bike pages and create folders corresponding to each bike.

There is a problem with this approach - you need to be logged-in as super-admin while executing this template for the folders to be created.
Also, whenever a new bike is added, you need to run this code afresh for the new folder to be created.

In short, the approach is not dynamic.

I suggest you please use the solution provided here for having a gallery per page -
viewtopic.php?f=8&t=8559

Hope this helps.

Brilliant thanks, not the answer to my problem as the double quotes also failed, but the resolution you gave works a treat
not the answer to my problem as the double quotes also failed

The only reason for that would be the value contained in bike_make -
<cms:folder name="<cms:show bike_make />" title="<cms:show bike_make />" />
If it has any characters not acceptable as 'name' of folder, you'll get the error.

The only safe value you can use is k_page_name
<cms:folder name="<cms:show k_page_name />" title="<cms:show k_page_title />" />


..but the resolution you gave works a treat
I am glad it helped :)
4 posts Page 1 of 1
cron