knockoutjs with yii framework(php)

133 views
Skip to first unread message

joshi.n...@gmail.com

unread,
Jul 1, 2014, 7:42:28 AM7/1/14
to knock...@googlegroups.com
I have used knockoutjs library with codeigniter php framework.
But I am using yii framework for my project.
How can I use knockoutjs with yii framework.?

Keuller Magalhaes

unread,
Jul 1, 2014, 8:12:07 AM7/1/14
to knock...@googlegroups.com
Hi Nagesh,

You can use the same way. Knockout is JS library that fit with any server side API. What is your question about that ?

Regards.

Nagesh Joshi

unread,
Jul 1, 2014, 8:19:28 AM7/1/14
to knock...@googlegroups.com
hey Keuller,
Thank you very much for your promt response.
How can I use knockout bindings for the view which is automatically generated by yii.

Here is my login page view:

<div class="row">
<?php echo $form->labelEx($model,'username'); ?>
<?php echo $form->textField($model,'username'); ?>
<?php echo $form->error($model,'username'); ?>
</div>

<div class="row">
<?php echo $form->labelEx($model,'password'); ?>
<?php echo $form->passwordField($model,'password'); ?>
<?php echo $form->error($model,'password'); ?>
</div>

How can I use knockout binding for the above textFiled or PasswordField.

Thanks in advance

Keuller Magalhaes

unread,
Jul 2, 2014, 5:52:48 PM7/2/14
to knock...@googlegroups.com
Nagesh,

You can't continue to use Yii form helpers, instead you must use plain HTML with Knockout bindings. I think you must rewrite your code to use HTML tags and load your data from rest service, IMHO is the best approach nowadays.

I've created an plugin that can help you to load data via JSON, please take a look https://github.com/keuller/knockout-rest

Regards.
Reply all
Reply to author
Forward
0 new messages