Vra

How could I set the minFontSize property on Zend_Tag_Cloud? It looks like that at the moment, but I get an error:

Decorator is no instance of 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;
Was dit nuttig?

Oplossing

Try something like this:

 $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
            )
        )
    )
);
Gelisensieer onder: CC-BY-SA met toeskrywing
Nie verbonde aan StackOverflow
scroll top