0

I have my module config like this

<config>
    <modules>
        <Foo_Bar>
            <version>1.0.0</version>
        </Foo_Bar>
    </modules>
    <global>
        <blocks>
            <foo_bar>
                <class>Foo_Bar_Block</class>
            </foo_bar>
        </blocks>
    </global>
</config>

I have my block class in the file

/app/code/local/Foo/Bar/Block/random.php

with content

class Foo_Bar_Block_Random extends Mage_Core_Block_Template {

  function __construct() {
    echo __METHOD__;
  }
}

I am expecting the method to be echoed in my home page(checking whether my block is working fine). But it is not echoing the method block method name

my /etc/config is

<config>
    <modules>
        <Foo_Bar>
            <active>true</active>
            <codePool>local</codePool>
        </Foo_Bar>
    </modules>
</config>

can somebody tell me what am i doing wrong?

1
  • And where are you code for your block call in homepage?
    – Mufaddal
    May 6, 2013 at 6:41

2 Answers 2

0

The block file should be named Random.php instead of random.php.
And you should add your block to the homepage.
Add this to CMS->Pages->Home page:

{{block type="foo_bar/random"}}

Make sure you cleared the cache. Also enable logging and, in case the block still does not appear check the var/log folder.

0
0

If you wish your block is call on your homepage then you must tell magento for call of your block.

If you are using home page cms then put this code in your cms content area

{{block type="foo_bar/random"}}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.