Problems, need help? Have a tip or advice? Post it here.
5 posts Page 1 of 1
Hello,

I'm trying to use CouchCMS, which seems to be a perfect match for the simple CMS solution I need. I have a problem using OrderBy for ordering clonable pages. I would like to show a summary of the individual pages on the default/parent page, by using the sort order I want. I found some information about this OrderBy feature on this forum, but that doesn't seem to help me to solve my problem. I also checked the documentation, that says:

http://www.couchcms.com/docs/tags-reference/pages.html
Orderby
The pages fetched can be sorted and ordered according to the following fields
....
Apart from the fields mentioned above, any of the custom field defined in the template (...) may be used for sorting the fetched pages.


I made the most simple page I can imagine to break down the problem. I would expect to be able to sort on the field SortOrder. But even this example gives me an error.

Code: Select all
ERROR: Unknown orderby clause "sortorder"


Can someone give me a clue on what I'm doing wrong? I use CouchCMS v1.4.
Thanks for your help!

Code: Select all
<?php require_once( '/couch/cms.php' );?>
<cms:template title='Order' clonable='1' commentable='0'>
   <cms:editable name='SortOrder' label='Sort order' type='text' search_type='integer' />   
   <cms:editable name='Text' label='The text' type='text' />   
</cms:template>
<cms:if k_is_page >
   <!-- this is shown when the page is called seperately e.g. order.php?p=1 -->
   <html>
   <body>
      <cms:show SortOrder/> : <cms:show Text/><br>
   </body>
   </html>
<cms:else />
   <!-- this is shown when the default main page is called e.g. order.php. I expect the data is sorted by using the values of the field SortOrder -->
   <html>
   <body>
      <cms:pages order='asc' orderby='SortOrder'>
         SortOrder = <cms:show SortOrder /><br>
         Text = <cms:show Text /><br>
      </cms:pages>
   </body>
   </html>
</cms:if>
<?php COUCH::invoke(); ?>
hi Peewie try setting "sortorder" with no Capital letters
Hello and welcome, Peewie

Please change the name of the editable region from 'SortOrder' to 'sortorder' (i.e. all lowercase)
<cms:editable name='SortOrder' label='Sort order' type='text' search_type='integer' />

Make sure to visit the template as super-admin for the change to take effect.
Hmmm... Thanks!
I tried for three days. Never expected it would be so simple ;)
Now I know this is the issue, I see it was also mentioned on http://www.couchcms.com/docs/tags-reference/editable/

Name
The only attribute that is mandatory. It needs to be unique amongst all the editable regions within the same template. Only lowercase[a-z] alphabets, numerals[0-9] hyphen and underscore are permitted to be used within a name.


RTFM. I just missed that one...

Thanks again!
5 posts Page 1 of 1