With Couch v2.x, this solution will no longer be required as it comes with this feature built-in. Please see the 'Manually reorder normal cloned pages' section at viewtopic.php?f=5&t=10241 for details.
Hi everybody
One big drawback of cloned-pages, as they exist as of v1.4.5, is that we cannot easily reorder them manually from the admin-panel (like what we can do with 'nested-pages').
Pages always appear in the descending order of their publish-dates and tweaking the publish-dates by editing each page, so as to reorder them, is too tedious to be considered practical.
To work around this limitation, some time back I coded up a quick-n-dirty solution that involves the use of 'custom admin-screens' (http://docs.couchcms.com/concepts/datab ... in-screens).
I think it could be useful to others so I am sharing it here.
N.B. Please treat this as a 'band-aid' fix for the current version (i.e. 1.4.5). The next version will have this functionality built in so this is just an interim measure.
In the attached zip, you'll find three files.
1. Please place the 'manual_sort.php' in 'couch/addons' folder.
2. Place the other two files (i.e. 'manual_sort.html' and 'manual_sort_inner.html') within the snippets folder of your installation - this location by default is 'couch/snippets' but can be changed from the config file. So please make sure to place the files in the correct folder).
With the files in place, suppose you wish to make a template named 'contacts.php' manually re-orderable, edit couch/addons/kfunctions.php (if this file is not present you'll have to rename the kfunctions.example.php to kfunctions.php) and add to it the following line -
And that is it. Coming back to the admin-panel you should find that you are able to manually reorder normal cloned pages just like nested-pages.
For every template you wish to add this functionality, just add the same line of code in kfunctions.php (of course, changing the name of the template).
Hope this helps.
Hi everybody
One big drawback of cloned-pages, as they exist as of v1.4.5, is that we cannot easily reorder them manually from the admin-panel (like what we can do with 'nested-pages').
Pages always appear in the descending order of their publish-dates and tweaking the publish-dates by editing each page, so as to reorder them, is too tedious to be considered practical.
To work around this limitation, some time back I coded up a quick-n-dirty solution that involves the use of 'custom admin-screens' (http://docs.couchcms.com/concepts/datab ... in-screens).
I think it could be useful to others so I am sharing it here.
N.B. Please treat this as a 'band-aid' fix for the current version (i.e. 1.4.5). The next version will have this functionality built in so this is just an interim measure.
In the attached zip, you'll find three files.
1. Please place the 'manual_sort.php' in 'couch/addons' folder.
2. Place the other two files (i.e. 'manual_sort.html' and 'manual_sort_inner.html') within the snippets folder of your installation - this location by default is 'couch/snippets' but can be changed from the config file. So please make sure to place the files in the correct folder).
With the files in place, suppose you wish to make a template named 'contacts.php' manually re-orderable, edit couch/addons/kfunctions.php (if this file is not present you'll have to rename the kfunctions.example.php to kfunctions.php) and add to it the following line -
- Code: Select all
$FUNCS->register_admin_listview( 'contacts.php', 'manual_sort.html' );
And that is it. Coming back to the admin-panel you should find that you are able to manually reorder normal cloned pages just like nested-pages.
For every template you wish to add this functionality, just add the same line of code in kfunctions.php (of course, changing the name of the template).
Hope this helps.