Magento Forum - UK Magento Forum (Unofficial)

An unofficial but dedicated Magento Forum for Magento Users, Designers and Developers

Newbie Wanting to add custom block

A forum for web designers working with the Magento system.

Newbie Wanting to add custom block

Postby Aidy » Mon Sep 27, 2010 2:07 pm

Hi I'm wanting to add a custom block into the header. I've created a template file callouts/flashscroller.phtml and added this to page.xml

Code: Select all
<block type="page/html_header" name="header" as="header">
                <block type="page/template_links" name="top.links" as="topLinks"/>
                <block type="page/switch" name="store_language" as="store_language" template="page/switch/languages.phtml"/>
                <block type="core/text_list" name="" as="topMenu"/>
                <block type="page/html_wrapper" name="top.container" as="topContainer" translate="label">
                    <label>Page Header</label>
                    <action method="setElementClass"><value>top-container</value></action>
        <block type="callouts/flashscroller" name="flashscroller" as="flashscroller" template="callouts/flashscroller.phtml"/><!-- Added  -->

page/html/header.phtml looks like this

Code: Select all

<div class="header-container">
    <div class="header">
        <?php if ($this->getIsHomePage()):?>
        <h1 class="logo"><strong><?php echo $this->getLogoAlt() ?></strong><a href="<?php echo $this->getUrl('') ?>" title="<?php echo $this->getLogoAlt() ?>" class="logo"><img src="<?php echo $this->getLogoSrc() ?>" alt="<?php echo $this->getLogoAlt() ?>" /></a></h1>
        <?php else:?>
        <a href="<?php echo $this->getUrl('') ?>" title="<?php echo $this->getLogoAlt() ?>" class="logo"><strong><?php echo $this->getLogoAlt() ?></strong><img src="<?php echo $this->getLogoSrc() ?>" alt="<?php echo $this->getLogoAlt() ?>" /></a>
        <?php endif?>
        <div class="quick-access">
            <?php echo $this->getChildHtml('topSearch') ?>
            <?php echo $this->getChildHtml('topLinks') ?>
            <?php echo $this->getChildHtml('store_language') ?>
        <?php echo $this->getChildHtml('topContainer'); ?>
        <?php echo $this->getChildHtml('topMenu') ?>
<?php echo $this->getChildHtml('flashscroller') ?><!-- Added -->

The flashscroller is not displaying can anyone please tell me where I'm going wrong? Thanks.
Posts: 1
Joined: Mon Sep 27, 2010 1:56 pm

Re: Newbie Wanting to add custom block

Postby David Oliver » Fri Oct 01, 2010 12:20 pm

Try changing the line you added to page.xml to:

Code: Select all
<block type="core/template" name="flashscroller" as="flashscroller" template="callouts/flashscroller.phtml"/>

Also make sure caching is turned off.
David Oliver
Posts: 1
Joined: Fri Oct 01, 2010 12:18 pm

Return to Magento Designers