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

Adding a variable to a page template based on the content of that page
 
gabrielk
Sr. Member
 
Avatar
Total Posts:  83
Joined:  2007-11-30
 

EDIT: let me rephrase.. 

I’ve edited /app/code/core/Mage/Core/Helper/Js.php—I modified function getTranslatorScript() so that we could load in fewer variables.  Example: by default a lot of error messages are loaded relating to phone number, etc.  I modified the function to be able to load up just the messages needed for a page.  It does this by passing a variable to the function, like getTranslatorScript($pageName), then the function itself loads a set of pre-defined translator text based on $pageName (with the default being the translator text set in the class constructor). 

The second half of this is to figure out how to load different scripts depending on what page you’re on. For example, at the top of /app/design/frontend/default/default/template/page/3columns.phtml is the code:

<?=$this->helper('core/js')->getTranslatorScript()?>
And I basically want to modify it to say:
<?
if(______{
    $pageName 
'foo';
elseif(________{
    $pageName 
'bar';
else {
    $pageName 
false;
}
$this
->helper('core/js')->getTranslatorScript($pageName);
?>
So I need help filling in the blanks.  I guess I’m looking for something like $this->getChildHtml(’content’) or something that will let me know what page is being loaded so that I can use it for the if/else switch.
 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top