Yii 1.1: ptags

Widget for using JQuery plugin "Pines Tags"
13 followers

I just quickly wrote a widget for the JQuery plugin Pines Tags. Pines Tags is a beautiful and easy to use plugin. Even so, this widget is very easy to use.

The Pines Tags plugin is untouched.

Have a look at the Github Repo.

Requirements

Yii 1.1 or above.

Usage

Just extract in your extensions directory and use it like every other widget:

$this->widget('application.extensions.PTags.PTags',array(
    'id'=>'die_hard',
    'value'=>'action,bruce fucking willis,awesome,explosions,dead terrorists',
    'options'=>array(
        'editable'=>false,
        'remover'=>false
    )
));

value are the tags seperated by delimiter(standard: ",") "hardcoded" into the value of the input tag. You can leave it empty and use the tags option if you want to submit an array.

Options are the same as pines tags offers, but without the _ptags__-prefix:

$options=array(
    'tags' => array(),
        'current_text' => true,
        'delimiter' => ",",
        'trim_tags' => true,
        'show_box' => false,
        'input_box' => true,
        'remover' => true,
        'editable' => true,
        'sortable' => false,
        );

Resources

Total 3 comments

#11863 report it
Yerlt at 2013/02/08 05:04am
RE: Solved it.

Hi NCS_One,

so this is an error related to PTags. Please submit your problem/solution as issue/pull request to the PTags git repositories.

#11855 report it
NCS_One at 2013/02/07 03:34pm
Solved it.

On "jquery.ptags.js" ptags creates a field named MyModel[MyAttribute]__ptags this is going to make "MyModel[MyAttribute]" an array. :(

I changed:

input_box.attr("id", input_box.attr("id") + "__ptags");
input_box.attr("name", input_box.attr("name") + "__ptags");

to:

input_box.attr("id", "__ptags_" + input_box.attr("id"));
input_box.attr("name", "__ptags_" + input_box.attr("name"));
#11820 report it
NCS_One at 2013/02/06 02:13am
Doesn't work.

If the name of the form field of the tags is something like:

MyModel[MyAttribute]

it doesn't work.

On the server "$_POST['MyModel']['MyAttribute']" is empty. Why?

Leave a comment

Please to leave your comment.

Create extension
Downloads