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

Mage_Core_Block_Template and header
 
giugio
Jr. Member
 
Total Posts:  14
Joined:  2013-03-24
 

hello.
I must create an header with some menu in my custom magento layout.
I thinking to use a ArteOroHeader.php file that inherits from Mage_Core_Block_Template because this header must appear in every pages in my layout.

After i have inherit from Mage_Core_Block_Template i have inserted the setting of the template in the constructor this:

protected function _construct()
    
{
        
        $this
->setTemplate('page/html/arteoroheader.phtml');
        
    
}
after i set in my custom layout this:
<block type="page/html_headarteoro" name="headarteoro" as="test"/>
the “test” section is inserted in 1column.phtml of the base/default layout :
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<
html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $this->getLang() ?>" lang="<?php echo $this->getLang() ?>">
<
head>
<?php echo $this->getChildHtml('head'?>
</head>
<
body<?php echo $this->getBodyClass()?' class="'.$this->getBodyClass().'"':'' ?>>
<?php echo $this->getChildHtml('after_body_start'?>
<div class="wrapper">
    
<?php echo $this->getChildHtml('global_notices'?>
    
<div class="page">
        
<?php echo $this->getChildHtml('test'?>//TEST TEST TEST <-----------TEST
        
<?php echo $this->getChildHtml('header'?>
        
<div class="main-container col1-layout">
            <
div class="main">
                
<?php echo $this->getChildHtml('breadcrumbs'?>
                
<div class="col-main">
                    
<?php echo $this->getChildHtml('global_messages'?>
                    <?php 
echo $this->getChildHtml('content'?>
                
</div>
            </
div>
        </
div>
        
<?php echo $this->getChildHtml('footer'?>
        <?php 
echo $this->getChildHtml('before_body_end'?>
    
</div>
</
div>
<?php echo $this->getAbsoluteFooter() ?>
</body>
</
html>
in local this block appear and works fine , but in remote on a linux server the block don’t appears.
I use the Template Path Hints and the Add Block Names to Hints but the arteoroheader.phtml don’t appears.
I place some var_dump before the $this->setTemplate(’page/html/arteoroheader.phtml’); but the setTemplate is don’t called, the error must be before , but where?
In local i work with windows 7.

very thanks.

 
Magento Community Magento Community
Magento Community
Magento Community
 
tzyganu
Mentor
 
Avatar
Total Posts:  2205
Joined:  2009-11-18
Bucharest, Romania
 

I assume that your local machine is running windows. And like you said the server is running linux.
I think the issue it the fact that windows files are not case sensitive and linux files are.
When calling this :

Mage::app()->getLayout()->createBlock('page/html_headarteoro'); //this is called for each block in layout
Magento looks for this class: Mage_Page_Block_Html_Headarteoro and the autoloader looks for this file: Mage/Page/Block/Html/Headarteoro.php
On windows this is the the same thing as Mage/Page/Block/Html/HeadArteOro.php
on linux the file is not found.
Rename your files to use only lowercase letters and the first should be uppercase.

Marius.

 
Magento Community Magento Community
Magento Community
Magento Community
 
giugio
Jr. Member
 
Total Posts:  14
Joined:  2013-03-24
 

very thanks.
solved.

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