app/code/community/Nexcessnet/Turpentine/Helper/Esi.php
public function getEsiLayoutBlockNode($layout, $blockName) {
        // first try very specific by checking for action setEsiOptions inside block
        $blockNodes = $layout->getNode()->xpath(
            sprintf('//block[@name=\'%s\'][action[@method=\'setEsiOptions\']]',
                $blockName)
        );
        $blockNode = end($blockNodes);
        // fallback: only match name
        if ( ! ($blockNode instanceof Mage_Core_Model_Layout_Element)) {
            $blockNodes = $layout->getNode()->xpath(
                sprintf('//block[@name=\'%s\']', $blockName)
            );
            $blockNode = end($blockNodes);
        }
        return $blockNode;
    }
public function getEsiLayoutBlockNode($layout, $blockName) {
        // first try very specific by checking for action setEsiOptions inside block
        $blockNodes = $layout->getNode()->xpath(
            sprintf('//block[@name=\'%s\'][action[@method=\'setEsiOptions\']]',
                $blockName)
        );
        $blockNode = end($blockNodes);
        // fallback: only match name
        if ( ! ($blockNode instanceof Mage_Core_Model_Layout_Element)) {
            $blockNodes = $layout->getNode()->xpath(
                sprintf('//block[@name=\'%s\']', $blockName)
            );
            $blockNode = end($blockNodes);
        }
        return $blockNode;
    }
public function getEsiLayoutBlockNode ( $ layout , $ blockName ) { // first try very specific by checking for action setEsiOptions inside block $ blockNodes = $ layout -> getNode ( ) -> xpath ( sprintf ( '//block[@name=\'%s\'][action[@method=\'setEsiOptions\']]' , $ blockName ) ) ; $ blockNode = end ( $ blockNodes ) ; // fallback: only match name if ( ! ( $ blockNode instanceof Mage_Core_Model_Layout_Element ) ) { $ blockNodes = $ layout -> getNode ( ) -> xpath ( sprintf ( '//block[@name=\'%s\']' , $ blockName ) ) ; $ blockNode = end ( $ blockNodes ) ; } return $ blockNode ; }
Grab a block node by name from the layout XML.

Multiple blocks with the same name may exist in the layout, because some themes
use 'unsetChild' to remove a block and create it with the same name somewhere
else. For example Ultimo does this.

@param Mage_Core_Model_Layout $layout
@param string $blockName value of name= attribute in layout XML
@return Mage_Core_Model_Layout_Element
Grab a block node by name from the layout XML .