Coded something up in Couch in an interesting way? Have a snippet or shortcode to share? Post it here for the community to benefit.
25 posts Page 2 of 3
This is cool! Thanks KK, this is very useful ;)
I love this addon, though I'd like to report an issue with PHP 7.2.3: it throws A LOT of errors like this:

Warning: Use of undefined constant name - assumed 'name' (this will throw an Error in a future version of PHP) in <path-to-project>\couch\addons\bootstrap-grid\bootstrap-grid.php on line 41
Thanks @Kulverstukas.
This issue has already been fixed - please get the version of Couch available from GitHub
https://github.com/CouchCMS/CouchCMS
@KK recently pushed an update to type 'row' which lets rows collapse -

2018-11-28-003.png
collapsed='1'
2018-11-28-003.png (9.55 KiB) Viewed 8093 times


2018-11-28-002.png
collapsed='0'
2018-11-28-002.png (13.92 KiB) Viewed 8093 times


It only needs adding the collapsed parameter to the row's definition (the value could be either '0' or '1' to set the initial state) e.g.

Code: Select all
<cms:editable name='row' type='row' order='1' label='Advanced' collapsed='1' >
   <cms:editable label='Origin' name='car_origin' type='text' class="col-xs-4"/>
   <cms:editable label='Drivetrain' name='car_drivetrain' type='text' class="col-xs-4"/>
   <cms:editable label='Cylinders' name='car_cylinders' type='text' class="col-xs-4" />
</cms:editable>


It is useful for rows nested inside already collapsible 'group' (to have two levels of collapsible content) but these could be used as standalone regions also as a (visually) lighter alternative to 'group'.

I tested this update and personally find it pretty neat - a quick solution to wrap some editables in a row to have them collapsed, while I am working on other fields. A piece of advice here is to add classes (col-*) at the last possible step, after all juggling with editables completed. It will keep the fields stacked, but easy to move around without breaking layout.

To use this cool feature, update your CouchCMS to the latest build - CouchCMS Version 2.2.beta (20181125). https://github.com/CouchCMS/CouchCMS/archive/master.zip
awesome !!!!!
Hi folks!

I was trying to use this bit of code
Code: Select all
<cms:editable name='grp_coordinates' label='Coordinates' type='group' >
   
   <cms:editable name='test_row' type='row' order='1' >
      <cms:each k_supported_langs as='lang' key='lc'>
         <cms:editable name="lng_<cms:show lc />" label="Longitude <cms:show lc />" type='text' class='col-xs-3' />
         <cms:editable name="lat_<cms:show lc />" label="Latitude <cms:show lc />" type='text' class='col-xs-3' />
      </cms:each>
    </cms:editable>
   
    <cms:editable name='test_row2' type='row' order='2' >
      <cms:each k_supported_langs as='lang' key='lc'>
         <cms:editable name="directions_<cms:show lc />" label="Directions <cms:show lc />" type='text' class='col-xs-6' />
      </cms:each>
    </cms:editable>
   
</cms:editable>

hoping that I will have a group with some fields in it... Instead I was looking at
2019-01-23 00_46_56-Panou Administrare.jpg
2019-01-23 00_46_56-Panou Administrare.jpg (24.36 KiB) Viewed 7865 times


I have to mention that is a brand new installation of Couch - latest version from GitHub, with multi-language addon from https://www.couchcms.com/forum/viewtopic.php?f=5&t=10979. If I'm taking out the 'group' tags, the fields are displaying correctly, but I quite need them inside the group. What I've done wrong?

Thanks a lot!
Edit 2: Something is not right. I tested rows with static values of editables and it all worked fine.
Code: Select all

<cms:editable name='grp_coordinates' label='Coordinates' type='group' >

   <cms:editable name='test_row' type='row' >
     <cms:editable name="lng_ru" label="Longitude <cms:show lc />" type='text' class='col-xs-1' />
     <cms:editable name="lat_ru" label="Latitude <cms:show lc />" type='text' class='col-xs-1' />
     <cms:editable name="lng_en" label="Longitude <cms:show lc />" type='text' class='col-xs-1' />
     <cms:editable name="lat_en" label="Latitude <cms:show lc />" type='text' class='col-xs-1' />
    </cms:editable>

   <cms:editable name='test_row2' type='row' >
     <cms:editable name="lng_ru2" label="Longitude <cms:show lc />" type='text' class='col-xs-1' />
     <cms:editable name="lat_ru2" label="Latitude <cms:show lc />" type='text' class='col-xs-1' />
     <cms:editable name="lng_en2" label="Longitude <cms:show lc />" type='text' class='col-xs-1' />
     <cms:editable name="lat_en2" label="Latitude <cms:show lc />" type='text' class='col-xs-1' />
    </cms:editable>

</cms:editable>

Edit 3: I guess, the order of the execution of the groups is not as usual and code-generated editables end up outside the group!
Something is very strange... As long as the "group" is there, there is no content inside it! :shock:
2019-01-23 01_30_30-Admin Panel.png
2019-01-23 01_30_30-Admin Panel.png (81.58 KiB) Viewed 7861 times
The type 'row' region expects the nested regions as its *immediate* children - the use of <cms:each> is causing this assumption to fail.

As a workaround to this issue, Instead of using nesting, please try the older method ('row' editable region as a self-closing tag with its children explicitly declaring it as their parent using the 'group' parameter) as follows -
Code: Select all
<cms:editable name='grp_coordinates' label='Coordinates' type='group' >
    <cms:editable name='test_row' type='row' order='-10' collapsed='0' />
    <cms:each k_supported_langs as='lang' key='lc'>
        <cms:editable name="lng_<cms:show lc />" label="Longitude <cms:show lc />" type='text' class='col-xs-3' group='test_row' />
        <cms:editable name="lat_<cms:show lc />" label="Latitude <cms:show lc />" type='text' class='col-xs-3' group='test_row' />
    </cms:each>
</cms:editable>

Hope this helps.
25 posts Page 2 of 3