Forum for discussing general topics related to Couch.
11 posts Page 1 of 2
I am trying to create a simple gallery - but along with image there will be a name, a short description and price.

gal01.png
gal01.png (11.51 KiB) Viewed 1406 times



There will be few categories in the gallery.
I would like to know if this can be done similar to the simple gallery example in the tutorials.. else what route should I take?

Few hints would be always welcome..
Thank you guys!
ok.. I did this with repeatable regions.
Now how do I add categories to the gallery.
Appreciate any help.. thanks.
What you need is pretty staple stuff -
I suggest you please use 'cloned pages' (as shown in our tutorial) and its 'folders' for categorization (https://docs.couchcms.com/miscellaneous ... lders.html). You may define any number of fields you desire.

Hope this helps.
Thank you..

How I defined:
Code: Select all
<cms:repeatable name='sale_items' label='Sale Items'>
   <cms:editable type='text' name='item_name' label='Item Name' />
   <cms:editable type='image' name='item_image' label='Item Image' show_preview='1' preview_width='150'  />
   <cms:editable type='text' name='item_desc' label='Item Description' />
   <cms:editable type='text' name='item_price' label='Item Price' />
</cms:repeatable>

& display part html is
Code: Select all
<cms:show_repeatable 'sale_items'>
   ...
   <div class="itembox">
      <h4><cms:show item_name /></h4>
      <img src="<cms:show item_image />" />
      <p><strong><cms:show item_price /></strong></p>
      <p><cms:show item_desc /></p>
   </div>
</cms:show_repeatable>

So can I add the template part in the definition and make the necessary changes to the display part to show the categories also.
Or should I do it similar to the gallery example?

Let me know, please..
Completed the categories part too.
Now I have an item name field in my template.
There is a title (k_page_title) also in the form.
In my case both hold the same value.

I understand that I can hide the page title with
Code: Select all
<cms:config_form_view>
    <cms:field 'k_page_name' hide='1'/>
    <cms:field 'k_page_title' hide='1'/>
</cms:config_form_view>

But not sure where to add this.
Thanks..
Ok.. got it. :)
Oops! After hiding the page name/title as above, now it says
Code: Select all
Name: Required field cannot be left empty


Alternately, can I change the title field name to Item Name..
or How can I solve this.
Appreciate any help.. thanks.
If I understood it right, you have defined a custom field for name and so the system 'title' field seems redundant.

As you have found out, the system field cannot be left empty so we cannot just hide it. We also need to now explicitly set its value (using the value your custom field holds). Please see viewtopic.php?f=2&t=11647#p31254 for an example. Hope you can adapt it to use value from your custom field.

That said, a simpler alternative would have been to *not* define a custom field and use only the system field instead (the label etc. of it can be tweaked).
Thanks @KK.

That said, a simpler alternative would have been to *not* define a custom field and use only the system field instead (the label etc. of it can be tweaked).

Exactly what I asked.
How should I do it..
How should I do it..

Remove the custom field and change the label/position of the system 'Title' field to resemble the removed custom field.
The system 'Name' field can be hidden because it fetches value from the 'Title' field.

Please see viewtopic.php?f=5&t=10241 for details on how to do all that.
Hope it helps.
11 posts Page 1 of 2