Zend_Tag_Cloud - 设置选项

时间:2009-12-06 13:02:11

标签: zend-framework zend-tag

如何在Zend_Tag_Cloud上设置minFontSize属性? 目前看起来像是这样,但我收到了一个错误:

  

Decorator不是Zend_Tag_Cloud_Decorator_Tag的实例

     $cloud = new Zend_Tag_Cloud(
        array(
            'tags' => array(
                array('title' => 'Code', 'weight' => 50),
                array('title' => 'Zend Framework', 'weight' => 100),
                array('title' => 'PHP', 'weight' => 25)
            )
        )
    );
    $cloud->setTagDecorator(array('minFontSize' => 20));

    echo $cloud;

1 个答案:

答案 0 :(得分:2)

尝试这样的事情:

 $cloud = new Zend_Tag_Cloud(
    array(
        'tags' => array(
            array('title' => 'Code', 'weight' => 50),
            array('title' => 'Zend Framework', 'weight' => 100),
            array('title' => 'PHP', 'weight' => 25)
        ),
        'tagDecorator' => array(
            'decorator' => 'HtmlTag',
            'options' => array(
                'htmlTags' => array(),
                'fontSizeUnit' => 'px',
                'minFontSize' => 20
            )
        )
    )
);