views:

45

answers:

1

I have a php array defined in "layout" known as default.phtml and that array is some thing like this

$mydata['abc'] = array("A","A","A","A","A","A","A");

I can get the Layout using a custom defined function

$cls = new cass();

$layout = $cls->getLayout() ;

How do i access the same array "$mydata['abc']" in the Controller and view . Can Any body Please help me

+1  A: 

You should move this array to your controller. I think it's not a good pratice put data hard-coded in your view.

Also, I think you can't get a variable defined in your view. When you use getLayout() method you are getting not the html code, but the component that render your layout, so you can call disableLayout() for example. But, even if it was the html, before you get it, the html and php code would be processed first and all of your variables would be lost. So, I think you should change your logic and pass this variable from your controller to your view.

Maybe if you post more information about what you are really trying to achieve, we can say the best way to do this.

Keyne