Coded something up in Couch in an interesting way? Have a snippet or shortcode to share? Post it here for the community to benefit.
14 posts Page 1 of 2
This is soo simple, but I will post it here anyways.

To achieve such effect:
Capture.PNG
Capture.PNG (10.08 KiB) Viewed 4534 times

create some dummy.php templates in some distant folder (snippets would be okay).
paste:
Code: Select all
<?php require_once '../couch/cms.php'; ?>
<cms:template title='----------------' executable='0' order='15'  />
<?php COUCH::invoke(); ?>

The trick is to manage proper order of all templates. Trivial stuff.
Make sure, the path to cms.php is properly reflected in the first line, if you moved template out of eyes.
Also put a message, to remove default text, that 'no editables defined'.

full code looks like this now:
Code: Select all
<?php require_once '../couch/cms.php'; ?>
<cms:template title='----------------' executable='0' order='999'   >
    <cms:editable label=''                                                  name='msg1'
                  type='message'
                  order='10'
                  >This is just a dummy separator template for styling purposes.
    </cms:editable>
</cms:template>
<?php COUCH::invoke(); ?>
A bit updated, with special symbol treated as solid line.

Is probably obsolete for CouchCMS > 1.4.7 :)

Code: Select all
<?php require_once( '/couch/cms.php' ); ?>

<cms:template title='───────group────────' order='10' /> 

<?php COUCH::invoke(); ?>


download (13).png
download (13).png (7.63 KiB) Viewed 4340 times
Hi there!

Quick question - is this still the preferred method for achieving this layout? I have scoured the forum for an updated way (or, less hack-y way) of doing this, but to no avail.

Please note that I am already using folders for the templates. As an example of what I am trying to do (and why):

One of the folders of templates I have is for 'Tags' (a series of pages that set up the masterpages to be used for editable type=relation on other templates). Therefore, these templates have "parent='_tags_'"

There are 12 pages, which could be further grouped into 3 blocks of 4. They all have very similar names, and looking at the list of all 12 is unpleasant and confusing. I would like to simply add a horizontal line between the first four and second four, and again between the second four and third four.

I am more than happy to use the approach outlined in this thread, but was just wondering (given its age) whether a new approach was available?

Best,

Anthony
Hi,

The introductory post on v2.0 (viewtopic.php?f=5&t=10241) has, amongst other customizations, a section devoted to sidebar "Grouping templates in the sidebar".

In addition, following thread has some more tips - viewtopic.php?f=4&t=11511&p=30740#p30740

Does any of that help?
Hi KK

I read through both of those before posting, and have read through them again, and I'm not sure that they do. I have already grouped all of my templates into various folders, and now it is just this one folder which contains 12 pages that is particularly messy still. The way I see it, I have 2 options:

Option One - break these 12 templates out of one "Tags" parent folder into 3 different sub-folders, each subfolder containing 4 templates. For example, in my specific user case this would be:

Current structure:
---Tags---
UK Patent Tags
EP Patent Tags
Foreign Patent Tags
International Patent Tags
UK Trade Mark Tags
EU Trade Mark Tags
Foreign Trade Mark Tags
International Trade Mark Tags
UK Design Tags
EU Design Tags
Foreign Design Tags
International Design Tags

New Structure:
---Patent Tags---
UK Patent Tags
EP Patent Tags
Foreign Patent Tags
International Patent Tags
---Trade Mark Tags---
UK Trade Mark Tags
EU Trade Mark Tags
Foreign Trade Mark Tags
International Trade Mark Tags
---Design Tags---
UK Design Tags
EU Design Tags
Foreign Design Tags
International Design Tags

I don't particularly like this approach, since I currently have 7 folders of templates already, and this approach would add two more. It also, IMO, would be less user-friendly.

Option Two - break up the list of items within the folder, using horizontal lines. For example, in my specific user case this would be:

---Tags---
UK Patent Tags
EP Patent Tags
Foreign Patent Tags
International Patent Tags
--------------------------------
UK Trade Mark Tags
EU Trade Mark Tags
Foreign Trade Mark Tags
International Trade Mark Tags
--------------------------------
UK Design Tags
EU Design Tags
Foreign Design Tags
International Design Tags

This is what trendoman has provided a solution for here, and I am more than happy to use these 'dummy templates' if that is the way to achieve this layout (i.e. grouping / breaking-up a list of templates once they are within a folder). I just wanted to check that there wasn't a better way of doing this, since the new versions that have come out since trendoman's solution was posted in 2016.

I am assuming that the "------------------" lines within the folder will be clickable, as if they were templates, and that they will display a template with no editable regions (I appreciate that trendoman has provided a method for customising how that appears to the admin). Also, this method requires additional php pages on the server. These are just two reasons that I was hoping there might since have been an alternative solution to achieving the layout - but, as I say, I am happy to use the present solution of dummy templates if that remains the current solution.

Thank you! :)

Anthony
@Anthony, a nice revive of this thread. I am sure, @KK will provide a solution :)
My very simple solution which partly works - (i just tried with one of my existing folders)

Code: Select all
    $FUNCS->add_event_listener( 'register_admin_menuitems', 'my_register_admin_menuitems' );
    function my_register_admin_menuitems(){
        global $FUNCS;

        $FUNCS->register_admin_menuitem( array('name'=>'_my_constructor_', 'title'=>'Constructor', 'is_header'=>'1', 'weight'=>'-1')  );
        $FUNCS->register_admin_menuitem( array('name'=>'_dummy_01_', 'title'=>'──────────────────', 'parent'=>'_my_constructor_', 'is_header'=>'0', 'weight'=>'10')  );
        $FUNCS->register_admin_menuitem( array('name'=>'_dummy_02_', 'title'=>'──────────────────', 'parent'=>'_my_constructor_', 'is_header'=>'0', 'weight'=>'20')  );
    }


Parent param places separators in the desired folder, Weight is the same as order in templates.

Problems:
#1 separators are clickable and look like a link, but thankfully do not open anything which is good.
#2 popup name still there (_dummy_01_) which can be tweaked but still ugly
#3 'class'=>'separator' (from existing beautiful separators in sidebar) does not work if menuitem has a parent.

sidebar.png
sidebar.png (11.09 KiB) Viewed 2901 times
Another update is adding a class to menuitem so, any kind of HTML can be injected in place of your separator and hopefully it solves the issue in a crude but working way. All 3 problems are gone since I used <span> instead of <a> and removed redundant popping title. Please share your final customization.
Hi @trendoman

Thank you - I will experiment with this - however I am currently having a bit of a nightmare with permissions (again) on the server, which I shall have to post about separately.

I promise to return here with my final customisation, once I am back up and running.

Best,

Anthony
14 posts Page 1 of 2