Problems, need help? Have a tip or advice? Post it here.
6 posts Page 1 of 1
So, I've been digging around for this one for just a little bit, I know how to create new template categories and rename them as such, but the client came to me with an interesting one. They want me to get rid of, or rename the root category "TEMPLATES" to Pages or Static Pages.

I tried making a new group called static pages and moved everything there, but they were not happy that the empty TEMPLATES category was still there and that the warning message about no managed templates was showing.

Getting rid of it would be a pain, so I just want to rename it, I'm sure there's an easy way to do this that I'm missing, and overall a rename would make my life much easier.... sales people! :P

Thanks again for the great CMS!
Hi Mike,

The solution for it is actually mentioned in the docs post (viewtopic.php?f=5&t=10241). Quoting from which -
At this point it might cross your mind - how to change the title of the two default menu-groups?
We could do that using some PHP code in kfunctions.php but I think you'd find it easier to do so by editing the 'couch/lang/EN.php' file where you'll find their texts listed as -

$t['menu_templates'] = 'Templates';
$t['menu_modules'] = 'Administration';

So, you need to edit the lang/EN.php file and change the name there.

Hope it helps.
LOL, I totally missed that part when I was looking around. That was exactly what I needed. Thanks again KK! :)
Here's a quick secondary question that I might have missed as well. When making a new section (not the templates or admin area), is there an easy way to have them collapsed by default when an admin logs on?

I'm sorting a lot of my pages into different categories, and there's a couple that don't need to be regularly accessed, it would be nice to get some of that screen space back.

Thanks again for all the help. :)
I'm sorting a lot of my pages into different categories ..
is there an easy way to have them collapsed by default when an admin logs on?

I ran into a similar situation recently. My solution was to do away with the 'Templates' group altogether and then create the multiple custom categories which showed up in a collapsed state to begin with and retained their collapsed/open status as the user clicks them open.

Here is a sample screenshot -
sidebar.png
sidebar.png (11.77 KiB) Viewed 2728 times


Any template not explicitly placed within one of those groups would appear in the root itself (as opposed to within the 'Templates' group as happens by default).

If the solution interests you, here is what needs to be done -

1. Turn on the sample admin theme by editing couch/config.php directive no. 26 and removing the leading double slashes -
Code: Select all
//define( 'K_ADMIN_THEME', 'sample' );

2. As you know, with the sample theme activated, any template placed within the 'couch\theme\sample' folder would be used by Couch instead of the default system templates. In the attached zip, you'll find three such templates. Extract them and put them in 'couch\theme\sample'.

3. Finally edit the kfunctions.php file already present in 'couch\theme\sample' and append the following code to it -
Code: Select all
// add new sidebar menu items
if( defined('K_ADMIN') ){
    $FUNCS->add_event_listener( 'register_admin_menuitems', 'my_register_admin_menuitems' );
    $FUNCS->add_event_listener( 'alter_admin_menuitems', 'my_alter_admin_menuitems' );

    function my_register_admin_menuitems(){
        global $FUNCS;

        $FUNCS->register_admin_menuitem( array('name'=>'company', 'title'=>'Company', 'is_header'=>'1', 'weight'=>'1')  );
        $FUNCS->register_admin_menuitem( array('name'=>'calendar', 'title'=>'Calendar', 'is_header'=>'1', 'weight'=>'2')  );
        $FUNCS->register_admin_menuitem( array('name'=>'programs', 'title'=>'Programs', 'is_header'=>'1', 'weight'=>'3')  );
        $FUNCS->register_admin_menuitem( array('name'=>'support', 'title'=>'Support', 'is_header'=>'1', 'weight'=>'4')  );
        $FUNCS->register_admin_menuitem( array('name'=>'archive', 'title'=>'Archive', 'is_header'=>'1', 'weight'=>'5')  );
    }

    function my_alter_admin_menuitems( &$items ){
        global $FUNCS;

        if( array_key_exists('_templates_', $items) ){
            unset( $items['_templates_'] ); // removed this so now all templates by default go in '_root_'.
        }
        $items['_modules_']['weight']=100; // move administration group further down
    }
}


And that should be it. You should find the menu items defined in the code above visible in the sidebar.
You may now edit/add/delete them to suit your use case.

Needless to say, any front end template can be placed within any of the categories defined above by using the 'parent' parameter of their <cms:template> block e.g.
Code: Select all
<cms:template title='Items' parent='company' order='0' clonable='1'>
..

Please try it and let me know if this helps.

Attachments

Hi, this is a very elegant solution and totallly allows to modify admin menu. However,, I'd like to ask if there is any possibility to have an option for sub-folders in that admin tree, in case we have a large tree structure. Would be especially useful with multilingual sites, where sections would be repeated for the sake of SEO friendly URLs
6 posts Page 1 of 1