I think this might be impossible but I thought I would ask from some of the Magento developers here.

I want to use the 'aftertext' attribute when using the addLink() method of the top links block in layout xml.

But, I want to use the output of a rendered block/template for the value.

Is this possible?

1 Answer 1


I have not tested this, but I think you can do this via a helper method, which simply returns the html of the generated block as its result.

Something like this:

class ProxiBlue_ModuleIcons_Helper_Data extends Mage_Core_Helper_Abstract {

    public function getBlockHtml(){

        $block = mage::getSingleton('core/layout')->createBlock(
                'MODULE/BLOCK', 'NAME.IN.LAYOUT');
        $html = $block->toHtml();
        return $html;



Then in the addLink xml directive, call the helper method. As an example:

<reference name="top.links">
        <action method="addLink" translate="label title" module="customer">
            <label>Log In</label>
            <url helper="customer/getLoginUrl"/>
            <title>Log In</title>
            <afterText helper="moduleicons/getBlockHtml"></afterText>

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.