Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Passing Values from Layout XML
 
desquite
Jr. Member
 
Total Posts:  9
Joined:  2008-03-01
 

Is it possible to pass values from the layout XML files and use them in the phtml files?  For example, I’d like to pass a value so that I can decide to show or hide a stylesheet in the head.phtml file.  Or, does that defeat the purpose of the layout XML files?  What should the syntax look like in the layout XML file if I just want to include a new static file that I made?

Thanks so much for the help!

 
Magento Community Magento Community
Magento Community
Magento Community
 
Moshe
Magento Team
 
Avatar
Total Posts:  1770
Joined:  2007-08-07
Los Angeles
 

definitely,

<block type="core/template" template="...">
  <
action method="setMyVariable"><value>Some text here</value></action>
</
block>

in template you can get it as:

<?php echo $this->getMyVariable() ?>
 
Magento Community Magento Community
Magento Community
Magento Community
 
desquite
Jr. Member
 
Total Posts:  9
Joined:  2008-03-01
 

Thanks so much!

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top