문제

I have this code:

 $link = $this->getLayout()->createBlock('core/text_tag')
        ->setTagName('a')
        ->setTagParams(array(
            'href'  => '#',
            'class' => 'link',
        ))
        ->setTagContents($text)
   ;

that creates a link <a href="#" class"link"></a>

how do I create a span element inside this type?

<a href="#" class"link"><span></span></a>
도움이 되었습니까?

해결책

Looking at the Mage_Core_Block_Text_Tag class, I guess that the fastest (not the most elegant...) way to do that is :

$link = $this->getLayout()->createBlock('core/text_tag')
    ->setTagName('a')
    ->setTagParams(array(
        'href'  => '#',
        'class' => 'link',
    ))
    ->setTagContents('<span>'.$text.'</span>')
;
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 magento.stackexchange
scroll top