Forum for discussing general topics related to Couch.
5 posts Page 1 of 1
I've changed this:
Code: Select all
<cms:folders root="<cms:if k_folder_parentid!='-1'><cms:show k_folder_name /></cms:if>" childof=k_folder_name orderby='weight'>

and my folderlisting can be altered by changing the weight on the folders.

I expected to create such a field for the pages as well by using a custom field and doing so:
Code: Select all
<cms:editable name='folder_weights' validator='decimal' type='text' />
...
<cms:pages folder=k_folder_name orderby=folder_weights order='asc'>

However, nothing happens? Any advice?


full code overview:
Code: Select all
               <!-- START IF -->   
                  <cms:if k_folder_totalpagecount = '0' >
                        
                        <p>Er zijn hier momenteel geen vastgoed projecten. </p>
                        
                     <cms:else/>
                        <!-- loop1 -->   
                        <cms:set count='0' scope='global'/>
                        <cms:folders root="<cms:if k_folder_parentid!='-1'><cms:show k_folder_name /></cms:if>" childof=k_folder_name orderby='weight'>      
                            <cms:if "<cms:not count/>">
                                <div class="row residenties linkResidentie">
                            </cms:if>
                            <div class="col-md-3"><img src="<cms:thumbnail k_folder_image width='250' height='250' crop='1' />" class="img-responsive" height="250px" width="250px">
                                 <div class="oranjeBanner"><img src="img/oranjeBanner.jpg" class="img-responsive"><h1><cms:show k_folder_title/></h1></div></div>
                            <cms:set count="<cms:add count '1'/>" scope='global'/>
                            <cms:if count == '4'>
                                <cms:set count='0' scope='global'/>            
                                </div>
                            </cms:if> 
                            <cms:pages folder=k_folder_name orderby=folder_weights order='asc'>                           
                                <cms:if "<cms:not count/>">
                                    <div class="row residenties linkResidentie">
                                </cms:if>
                                <div class="col-md-3"><img src="<cms:thumbnail afbeelding_residentie_thumb width='250' height='250' crop='1' />" class="img-responsive" height="250px" width="250px"><div class="<cms:show k_page_name/>">
                              <img src="img/pijl.png"><a href="#"><cms:show k_page_title/></a></div></div>
                                <cms:set count="<cms:add count '1'/>" scope='global'/>
                                <cms:if count == '4'>
                                    <cms:set count='0' scope='global'/>         
                                    </div>
                                </cms:if>
                            </cms:pages>
                        </cms:folders>                  
                        <cms:if count>
                            <cms:repeat count="<cms:sub '4' count/>">
                                <div class="spacer">&nbsp;</div>
                            </cms:repeat>               
                            </div>
                        </cms:if>
                        <!-- /loop1 -->
                     </cms:if>
                     <!-- FINAL IF -->
Could you please try adding search_type='decimal' to the editable region?
Hi Cheesypoof, thanks but it didn't quite work yet but i figured it out...

I did your remark
Code: Select all
<cms:editable name='folder_weights' validator='decimal' search_type='decimal' type='text' order='6' />


and added this to make it work:
Code: Select all
<cms:pages folder=k_folder_name custom_field='folder_weights' orderby='folder_weights' order='asc'> 
I missed it originally so I'm glad you found the issue: you had
Code: Select all
orderby=folder_weights
instead of
Code: Select all
orderby='folder_weights'
With that said, I don't believe the custom_field parameter is necessary.
Thanks cheesypoof. You are correct, it wasn't necessary, just checked...
(I came across this while doing a search and it was used for filtering and altering the output which I was after).

for future reference and those interested...
custom_field info is described here and is basically used for searching that specific variable in the database and asking for the output: http://www.couchcms.com/docs/tags-reference/pages.html

So in the code above, I'm actually filtering through the cloned pages, and then reordering them while outputting... (Since there always is a value, filtering before is superfluous)
5 posts Page 1 of 1