Displaying 71-80 of 274 results.
Resolved: Yii2 required rule not show red star(asterisk) symbol
posted by admin on February 21, 2017
I have form and I have required fields
In output not showing red asterisk(star).
How to resolve it?Read more
Resolved: How to cretae(make) .htaccess file in Net Beans
posted by admin on February 6, 2017
I want to create .htaccess file in NetBeans.
I want to relize it by short and easy way.
How to make it?Read more
Resolved: Yii redirect from model
posted by admin on May 22, 2016
In model I try use redirect, but it is not working

$this->redirect(array('author'));

It working only from controller. I want to redirect from modelRead more
Resolved: Yii 1.1 CHtml listData with relation table
posted by admin on April 5, 2016
I have the list of array from my model

CHtml::listData($tags, 'id', 'post_id')


In model

/**
* @return array relational rules.
*/
public function relations()
{
// NOTE: you may need to adjust the relation name and the related
// class name for the relations automatically generated below.
return array(
'post' => array(self::BELONGS_TO, 'Post', 'post_id'),
);
}


I want to get listData like this

CHtml::listData($tags, 'id', /*here is syntax to get relation name*/)
Read more
Wiki: Yii 1.1 Add Yii Translation to website, multilanguage functionalitywiki
posted by admin on March 5, 2016
1. Step
Create Messages Folder in directory protected

2. Step
Create your multilanguage translation folder in directory Messages, for example hy, ru etc.

3. Step
Create files translation.php in your translation folders, which you created hy, ru

4. Step
Edit your translation.php files, and open massive like

<?php
/* ру */
return array(
'Username'=>'Имя пользователя',
'Admin'=>'Админ'
)


5. Step
Call translation function on your project

Yii::t('translation', 'Username')//translation - translation.php, 'Username' - the word, which you want to translate


* You can have many translation to same word

You can create for example app.php on your translation folders 'hy', 'ru' etc., and you can call same word by another translation.

6. Step
You can Create files app.php in your translation folders, which you created hy, ru

7. Step
Edit your app.php files, and open massive like

<?php
/* ру */
return array(
'Username'=>'Логин',
'Admin'=>'Администратор'
)


8. Step
Call translation function on your project by different translation

Yii::t('translation', 'Username')//translation - translation.php, 'Username' - the word, which you want to translate

or

Yii::t('app', 'Username')//app - app.php, 'Username' - the word, which you want to translate
Read more
Resolved: Yii2 Error Exception: Class 'Custom class' not found
posted by admin on February 15, 2017
I use in migration classes custom helper class Table, and in migration up process got an error like
Command:

./yii migrate

Result until error

Yii Migration Tool (based on Yii v2.0.11.2)

Total 2 new migrations to be applied:
m170213_124818_init
m170214_092410_domain

Apply the above migrations? (yes|no) [no]:yes
*** applying m170213_124818_init


Error Message:

Exception: Class 'yii\helpers\Table' not found (/var/www/html/basic/migrations/m170213_124818_init.php:10)


My class is in root directory in helpers directory

<?php
namespace yii\helpers;
class Table
{
public static $user = 'user';
public static $role = 'role';
public static $status = 'status';
public static $domain = 'domain';
}


In migration class

<?php
use yii\db\Migration;
use yii\helpers;

class m170213_124818_init extends Migration
{
public function safeUp()
{
/** User Create*/
$this->createTable('{{%'.helpers\Table::$user.'}}', [
'id' => $this->primaryKey(10)->notNull()->unsigned(),
. . .
], 'ENGINE=InnoDB');
}
}


How to resolve itRead more
Resolved: Yii Cmenu add class to item
posted by admin on April 23, 2016
I need an output like this html code

<ul class="yw0">
<li><span class="highlighter"></span><a href="#">Sign in</a>
</li>
<li><a href="#">Register</a>
</li>
</ul>


The code would be similar something but what would be the exact code to create an extra <span class="highlighter"></span> after the li tag and before the a tag**

<?php $this->widget('zii.widgets.CMenu',array(
'id'=>'menu',
'items'=>array(
array('label'=>'Signin', 'url'=>array('/site/signin')),
array('label'=>'Register', 'url'=>array('/site/register'))
),
)); ?>
Read more
Resolved: Yii check if user logged in of guest
posted by admin on April 14, 2016
I want to check my visitor type, guest or logged in user.Read more
Resolved: Yii CGridView custom column not and not show html data attribute
posted by admin on April 24, 2016

echo CHtml::link(
CHtml::image(Yii::app()->request->baseUrl.'/images/op-create.png', "image", array("width"=>30)),
Yii::app()->request->baseUrl.'/images/op-create.png',
array("class"=>"highslide", 'rel'=>'myrel'));

output :

<a class="highslide" rel="myrel" href="/web/images/op-create.png"><img width="30" src="/web/images/op-create.png" alt="image" /></a>



$this->widget('zii.widgets.grid.CGridView', array(
'id'=>'loc-grid',
'dataProvider'=>$model->search(),
'filter'=>$model,
'columns'=>array(
array('name'=>'loc_picture',
'type'=>'html',
'header'=>'Picture',
'value'=> 'CHtml::link(CHtml::image(Yii::app()->request->baseUrl.$data->loc_picture, "image", array("width"=>30)), Yii::app()->request->baseUrl.$data->loc_picture, array("class"=>"highslide", \'rel\'=>\'myrel\'))',
'htmlOptions'=>array('width'=>'40','style'=>'text-align:center;'),
),
),
));

output :

<a class="highslide" href="/web/pictures/noimage.jpg"><img width="30" src="/web/pictures/noimage.jpg" alt="image" />

Why output in CGridView, REL="myrel" not shown???Read more
Resolved: Yii cjuidatepicker not saving
posted by admin on January 30, 2016
I have this field in my _form.php

<?php
$this->widget('zii.widgets.jui.CJuiDatePicker',
array(
'model' => $model,
'attribute' => 'founding',
'language' => Yii::app()->language,
'flat' => false, // tells the widget to show the calendar inline
'options' => array(
'showOn' => 'both', // also opens with a button
'dateFormat' => 'yy-mm-dd', // format of "2012-12-25"
'showOtherMonths' => true, // show dates in other months
'selectOtherMonths' => true, // can seelect dates in other months
'changeYear' => true, // can change year
'changeMonth' => true, // can change month
'yearRange' => '2000:2099', // range of year
'minDate' => '2000-01-01', // minimum date
'maxDate' => '2099-12-31', // maximum date
'showButtonPanel' => true, // show button panel
),
'htmlOptions' => array(
'size' => '10',
'maxlength' => '10',
),
)
);
?>


Controller SAVE() saving NULL. I var_dump($model) and see NULL.
Please help me to correct.Read more