Re: Adding helper in layout

2007-10-16 Thread dijaplus

Try var $helper = array('CssMenu') as cakephp conventions


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Adding helper in layout

2007-10-03 Thread firdzak

Hi
How to add helper in layout

example, i have a default layout and i want to set a drop down menu at
the menu div.
i have to get a helper in my app/helpers/css_menu to run a function
the maual says that we have to get our helper in array.
but it still dotn wotk for me when i include var $helper = array
('css_menu');
can some one help me..


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: adding helper

2006-11-12 Thread Andrej

Meek,
you are right.
At least I get familiar with inheritance model in cakephp.
Thanks,
a.


--~--~-~--~~~---~--~~
 You received this message because you are subscribed to the Google Groups 
"Cake PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: adding helper

2006-11-12 Thread meek

Hi,
Your solution shouldn't be necessary.
Cake merges $helper, $component and even $uses arrays automatically.
So if you have ...
var $helpers = array('Html','Javascript');
... in your AppController, and ...
var $helpers = array('MyHelper');
... in your child controller, then all three Helpers will be available
in your child controller's views. You should watch out with case
though, the names of the helpers in these arrays should always be
capitalized.



Andrej schrieb:

> As I've got solution I post it to community.
> According to http://www.php.net/manual/en/keyword.parent.php it's
> impossible to access parent variables using parent::
> The only way to access parent variable is _not_ to use same variable
> name in derived class.
>
> So I put a new variable into my custom Controller and wrote constructor
> to merge helper definition arrays.
>
> app_controller.php:
>  class AppController extends Controller {
>   var $helpers = array('html','javascript');
> }
> ?>
>
> controllers/investors_controller.php:
>  class InvestorsController extends AppController {
>   var $extendHelpers = array('Child', 'Contact');
>   function __construct(){
>   parent::__construct();
>   $this->helpers = array_merge($this->helpers, 
> $this->extendHelpers);
>   }
> }
> ?>


--~--~-~--~~~---~--~~
 You received this message because you are subscribed to the Google Groups 
"Cake PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: adding helper

2006-11-12 Thread Andrej

As I've got solution I post it to community.
According to http://www.php.net/manual/en/keyword.parent.php it's
impossible to access parent variables using parent::
The only way to access parent variable is _not_ to use same variable
name in derived class.

So I put a new variable into my custom Controller and wrote constructor
to merge helper definition arrays.

app_controller.php:


controllers/investors_controller.php:
helpers = array_merge($this->helpers, 
$this->extendHelpers);
}
}
?>


--~--~-~--~~~---~--~~
 You received this message because you are subscribed to the Google Groups 
"Cake PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: adding helper

2006-11-12 Thread Andrej



On Nov 11, 8:55 pm, "Andrej" <[EMAIL PROTECTED]> wrote:
> in AppController I've got two default helpers:
>
> var $helpers = array('html','javascript');
>
> in EmployeesController I want to use another helper, the Child helper.
> It is possible by typing:
>
> var $helpers = array('Html', 'Javascript', 'Child');
>
> Question is:
> when I add 'scriptaculous' helper into AppController, do I have to
> update all my controllers and add 'scriptaculous' to all helpers or
> there is some way to just extend default helper array?
> 
> Thanks in advance,
> a.


--~--~-~--~~~---~--~~
 You received this message because you are subscribed to the Google Groups 
"Cake PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



adding helper

2006-11-11 Thread Andrej

in AppController I've got two default helpers:

var $helpers = array('html','javascript');

in EmployeesController I want to use another helper, the Child helper.
It is possible by typing:

var $helpers = array('Html', 'Javascript', 'Child');

Question is:
when I add 'scriptaculous' helper into AppController, do I have to
update all my controllers and add 'scriptaculous' to all helpers or
there is some way to just extend default helper array?

Thanks in advance,
a.


--~--~-~--~~~---~--~~
 You received this message because you are subscribed to the Google Groups 
"Cake PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---