Advanced CTabView using CClipWidget

2 0
2
Viewed: 22 852 times
Version: Unknown (update)
Category: Tutorials
    Written by: krillzip krillzip
    Updated by: Yang He Yang He
    Created: Feb 11, 2009
    Updated: 14 years ago

    You are viewing revision #5 of this wiki article.
    This is the latest version of this article.
    You may want to see the changes made in this revision.

    « previous (#4)

    Here is a way to dynamically extend tabs based on clips.
    Probably even more complex things could be done.

    <?php $this->beginWidget('system.web.widgets.CClipWidget', array('id'=>'My tab 1')); ?>
        My tab 1 ...
    <?php $this->endWidget(); ?>
    
    <?php $this->beginWidget('system.web.widgets.CClipWidget', array('id'=>'My tab 2')); ?>
        My tab 2 ...
    <?php $this->endWidget(); ?>
    
    <?php $this->beginWidget('system.web.widgets.CClipWidget', array('id'=>'My tab 3')); ?>
        My tab 3 ...
    <?php $this->endWidget(); ?>
    
    <?php
    $tabParameters = array();
    foreach($this->clips as $key=>$clip)
        $tabParameters['tab'.(count($tabParameters)+1)] = array('title'=>$key, 'content'=>$clip);
    ?>
    
    <?php $this->widget('system.web.widgets.CTabView', array('tabs'=>$tabParameters)); ?>
    
    Links ΒΆ

    Russian Version