Controller title

34 views
Skip to first unread message

Artyom M

unread,
Oct 28, 2014, 1:23:25 AM10/28/14
to koala-fra...@googlegroups.com
Niko,

How can I add title to controllers? I need to change tab name after I chage controller/view in kwf-app. 
In HTML <title>controller_name</title>.

Now I see  application.name everywhere.

I need: application.name + " - " + <controller>

For example:
Demo - Login (start page)
Demo - Customers (customers controller)
etc

Niko Sams

unread,
Oct 28, 2014, 4:24:52 PM10/28/14
to Koala Framework Dev
that is currently hardcoded (see views/master.tpl)
you can override the defualt master.tpl by copying that to your app (into views/master.tpl)

and you can also pass additional vars into the view (like the controller name) by assigning them
in your action like (eg. indexAction)
$this->view->foo = 'Foo';


Niko


--
You received this message because you are subscribed to the Google Groups "Koala Framework Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to koala-framework...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Artyom M

unread,
Oct 30, 2014, 9:28:21 AM10/30/14
to koala-fra...@googlegroups.com
>you can override the defualt master.tpl by copying that to your app (into views/master.tpl)
Wow, this works! 

I typed in this file:
<title>App: <?= $this->applicationName; ?></title>

And now I see in all pages: 
App: myappName

But in which variable controller name has stored? I use trl for my language and need controller name on it.

Artyom M

unread,
Oct 30, 2014, 10:38:27 AM10/30/14
to koala-fra...@googlegroups.com
I figured it out.

What I did:
1. Copy master.tpl from \kwf-lib\views to \views
2. Change 1 line in master.tpl to <title><?= $this->controllerTitle; ?><?= $this->applicationName; ?></title>
3. Pass additional var $this->view->controllerTitle = 'Foo &mdash; '; (mdash in var needs to show title normal without it) 

That's all. It works.
Thanks, Niko.

Niko Sams

unread,
Oct 30, 2014, 12:45:21 PM10/30/14
to Koala Framework Dev
yeah, that's how it's supposed to work - glad you found that.

Niko

--

Artyom M

unread,
Oct 30, 2014, 8:10:56 PM10/30/14
to koala-fra...@googlegroups.com
And how can I get title from view (in js-file) to assigh with a variable? 

eg.:
var grid = new Kwf.Auto.GridPanel({
            controllerUrl   : '/employees',
            region          : 'west',
            width           : 400,
            resizable       : true,
            split           : true,
            collapsible     : true,
            title           : trlKwf('Flight crew'),   <-------------
....

Niko Sams

unread,
Oct 31, 2014, 12:07:16 PM10/31/14
to Koala Framework Dev
that is not possible.
javascript is loaded after the title tag, so you can't do that.

(well, possibly change the title using javascript, but that's an ugly hack)

Niko

--

Artyom M

unread,
Nov 1, 2014, 9:34:19 AM11/1/14
to koala-fra...@googlegroups.com
In most of controllers in indexAction() function I see:
$this->view->ext('<view name>');

But I have found that not all of controllers has indexAction() function and it works normal. 
What view is using by default?

Artyom M

unread,
Nov 1, 2014, 10:19:58 AM11/1/14
to koala-fra...@googlegroups.com
Niko,

How to add title in the same way as you wrote higher to Login page and User management page? Their controllers are somewhere in the wilds of \kwf-lib folder.

Niko Sams

unread,
Nov 4, 2014, 2:24:12 AM11/4/14
to Koala Framework Dev
if you have in one view two auto grids you only need one indexAction. the action is basically just the point where extjs is started.

also see this:

--

Niko Sams

unread,
Nov 4, 2014, 2:29:22 AM11/4/14
to Koala Framework Dev
see here:
http://www.koala-framework.org/documentation/kwf_general_features/users/user_management

you can create your own user management controllers that inherit the kwf ones and customize them as you wish.
also make sure you change acl resources to point to your customized controllers.


The login page is a bit harder to change - that is currently not possible.
In Kwf version 3.8 it is however possible, we created a nice styleable template that you can also override.


Niko


On Sat, Nov 1, 2014 at 3:19 PM, Artyom M <psycho...@gmail.com> wrote:
Niko,

How to add title in the same way as you wrote higher to Login page and User management page? Their controllers are somewhere in the wilds of \kwf-lib folder.

--

Artyom M

unread,
Nov 4, 2014, 5:02:13 AM11/4/14
to koala-fra...@googlegroups.com
>you can create your own user management controllers that inherit the kwf ones and customize them as you wish.
>also make sure you change acl resources to point to your customized controllers.

I create UserExController.php in \controllers dir where extends Kwf_Controller_Action_User_UsersController and add title in indexAction().

then i changed in acl.php:
$this->addResource(new Kwf_Acl_Resource_MenuUrl('kwf_user_users', array('text'=>trlKwfStatic('Users management'), 'icon'=>'user_suit.png'), '/usersex'), 'default_settingsmenuitem');

But when I click on menu item - 404 error:
The requested URL "/usersex" was not found on this server.

I think that I need file Usersex.js in \js folder where i also extends users default controller js. Right? I created this (sorry, I don't know how to extend and what) and also nothing.

What I'm missed?

Artyom M

unread,
Nov 4, 2014, 7:17:59 AM11/4/14
to koala-fra...@googlegroups.com
my UsersexController.php:
<?php

echo "test";

abstract class Kwf_Controller_Action_User_UsersController_Ex extends Kwf_Controller_Action_User_UsersController
{
        protected $_paging = 100;
public function indexAction()
        {
$this->view->controllerTitle = trlKwf('Users management') . ' &mdash; ';
}
}

Output:
test  <---- works!

 

Not Found

The requested URL "/usersex" was not found on this server.

1.137 sec
Memory: 5951 kb
DB-Queries: 1
classes included: 54
ms%Checkpoint
111setUp
636Action::init
10Action::preDispatch
106293shutDown

Niko Sams

unread,
Nov 5, 2014, 2:34:20 AM11/5/14
to Koala Framework Dev
This must be an controller like all others you already have in your application:

1. remove the abstract
2. name your controller class correctly (have a look at the others in the same directory)
(UsersexController I would guess)
3. add an entry to acl with resource id referring to your new controller (usersex instead of kwf_user_users)


Niko

--

Artyom M

unread,
Nov 17, 2014, 8:22:27 AM11/17/14
to koala-fra...@googlegroups.com
Not working =(

Still the same 404 error...

Niko Sams

unread,
Nov 19, 2014, 11:49:30 AM11/19/14
to Koala Framework Dev
can you push your code somewhere so I can have a look?

Niko

On Mon, Nov 17, 2014 at 2:22 PM, Artyom M <psycho...@gmail.com> wrote:
Not working =(

Still the same 404 error...

--

Artyom M

unread,
Nov 20, 2014, 6:51:49 PM11/20/14
to koala-fra...@googlegroups.com
In attach.

Controller - UsersexController.php.
ACL - Acl.php (lines from 453 to 464).

Error 404 now - "/usersex" not found on this server.
UsersexController.php
Acl.php

Niko Sams

unread,
Nov 21, 2014, 3:41:55 AM11/21/14
to Koala Framework Dev
you are using a resource with id 'default_usersmanagement', correct would be 'default_usersex'

Niko

--

Artyom M

unread,
Nov 22, 2014, 5:44:42 AM11/22/14
to koala-fra...@googlegroups.com
Thanks, Niko. It works! =))
Reply all
Reply to author
Forward
0 new messages