Yii 1.1: tag-widget

Tag widget

A tag form, use it with taggable behvior




Change Log

August 11, 2010

  • Initial release.

Total 3 comments

#16524 report it
LarryTX at 2014/03/02 12:39pm
Formatting the dropdown

I've finally got this working thanks to many of the posts in the forum for this extension, especially Aceman3000 who put me on the trail of creating a json.php. However, using that, as specified by Aceman, gives me a dropdown with three lines for each potential match as you might expect from his code which specifies that id, label, and value be echoed.

[<?php if($tags){
$total = count($tags) - 1;
foreach ($tags as $i =>$tag){
    //echo $tag->name;
    echo '{';
    echo '"id": "'.$tag->id.'",';
    echo '"label": "'.$tag->name.'",';
    echo '"value": "'.$tag->name.'"';
    echo '}';
    if($total !== $i){
        echo ',';

What I'd like to do is display just the label much like more traditional, HTML-generated dropdowns with the id and value hidden behind it. Unfortunately, my jQuery/JavaScript skills are about zilch. Can anyone help me with how to achieve that?

#11180 report it
Mirocow at 2012/12/23 07:34pm
My fix

replace all into

  //->registerCoreScript('jquery') FIX
        tags: '.$tags.',
        url: "'.$url.'"
', CClientScript::POS_READY);

$tag_it - it`s my variable from widget

public function run()
        $this->tags = json_encode($this->tags);
        // this method is called by CController::endWidget()
        $this->render('TagView', array(
            'id' => $this->id,
            'tags' => $this->tags,
            'url' => $this->url,
            'tag_it' => dirname(__FILE__),
            'title' => $this->title,
#10549 report it
xtranophilist at 2012/11/04 03:59am
FIx that works for me

In the file TagView.php, delete the line


And replace




Leave a comment

Please to leave your comment.

Create extension
  • Yii Version: 1.1
  • License: New BSD License
  • Developed by: mech7
  • Category: User Interface
  • Votes: +1
  • Downloaded: 1,848 times
  • Created on: Aug 12, 2010
  • Last updated: Aug 12, 2010