In your controller:
- $this->set('abc', $abc);

In your view:
- echo $this-element('left', array('abc' => $abc));

In your element:
- echo $abc;

Jeremy Burns
Class Outfit

[email protected]
http://www.classoutfit.com

On 24 Mar 2011, at 05:43, Shashank wrote:

> so then tell me one thing...
> i have a varibale $abc in my controller...
> How can i get it in my app/views/elements/left.ctp file??
> 
> On Thu, Mar 24, 2011 at 11:10 AM, Jeremy Burns | Class Outfit 
> <[email protected]> wrote:
> Yes, this is a view function. Think of an element as an include that renders 
> data; so it can only be called in a view. A navigation menu or log in panel 
> are good examples.
> 
> If you want to have common functions that process data and are accessible 
> from many controllers, use a component.
> 
> Elements, components and behaviours are blocks of code that can be referenced 
> from anywhere with the following limitations:
> - Elements => views
> - Components => controllers
> - Behaviours => models
> 
> 
> Jeremy Burns
> Class Outfit
> 
> [email protected]
> http://www.classoutfit.com
> 
> On 24 Mar 2011, at 05:36, Shashank wrote:
> 
>> i am calling it in my controller
>> why??
>> Am i doing it wrong??
>> I am new to cake php so dont have much idea abt this..
>> 
>> On Thu, Mar 24, 2011 at 11:03 AM, Jeremy Burns | Class Outfit 
>> <[email protected]> wrote:
>> Are you calling this in a view or in a controller?
>> 
>> Jeremy Burns
>> Class Outfit
>> 
>> [email protected]
>> http://www.classoutfit.com
>> 
>> On 24 Mar 2011, at 05:31, Shashank wrote:
>> 
>> > I am getting this error while using echo $this->element('left',
>> > array("b" => "current"));....
>> >
>> > Error i am getting is:
>> >
>> > Call to undefined method UsersController::element()
>> >
>> > Can someone tell me wats the issue here is??
>> >
>> > --
>> > Our newest site for the community: CakePHP Video Tutorials 
>> > http://tv.cakephp.org
>> > Check out the new CakePHP Questions site http://ask.cakephp.org and help 
>> > others with their CakePHP related questions.
>> >
>> >
>> > To unsubscribe from this group, send email to
>> > [email protected] For more options, visit this group 
>> > at http://groups.google.com/group/cake-php
>> 
>> --
>> Our newest site for the community: CakePHP Video Tutorials 
>> http://tv.cakephp.org
>> Check out the new CakePHP Questions site http://ask.cakephp.org and help 
>> others with their CakePHP related questions.
>> 
>> 
>> To unsubscribe from this group, send email to
>> [email protected] For more options, visit this group at 
>> http://groups.google.com/group/cake-php
>> 
>> 
>> 
>> -- 
>> Shashank Singh
>> B.E.(Computer Science)
>> Software Developer
>> +91-9711882054
>> +91-9560545085
>> Skype id: shashank.singh87
>> Email: [email protected]
>> 
>> 
>> -- 
>> Our newest site for the community: CakePHP Video Tutorials 
>> http://tv.cakephp.org 
>> Check out the new CakePHP Questions site http://ask.cakephp.org and help 
>> others with their CakePHP related questions.
>>  
>>  
>> To unsubscribe from this group, send email to
>> [email protected] For more options, visit this group at 
>> http://groups.google.com/group/cake-php
> 
> 
> -- 
> Our newest site for the community: CakePHP Video Tutorials 
> http://tv.cakephp.org 
> Check out the new CakePHP Questions site http://ask.cakephp.org and help 
> others with their CakePHP related questions.
>  
>  
> To unsubscribe from this group, send email to
> [email protected] For more options, visit this group at 
> http://groups.google.com/group/cake-php
> 
> 
> 
> -- 
> Shashank Singh
> B.E.(Computer Science)
> Software Developer
> +91-9711882054
> +91-9560545085
> Skype id: shashank.singh87
> Email: [email protected]
> 
> 
> -- 
> Our newest site for the community: CakePHP Video Tutorials 
> http://tv.cakephp.org 
> Check out the new CakePHP Questions site http://ask.cakephp.org and help 
> others with their CakePHP related questions.
>  
>  
> To unsubscribe from this group, send email to
> [email protected] For more options, visit this group at 
> http://groups.google.com/group/cake-php

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to