Displaying 61-70 of 274 results.
Resolved: Yii universal action in controller to missing actions methods
posted by admin on April 11, 2016
I have a controller in Yii:

class PageController extends Controller {
public function actionSOMETHING_MAGIC($pagename) {
// Commando will to rendering,etc from here

I need some magic method under Yii CController for controlling all subrequest under /page || Page controller.Read more
Resolved: Yii 1.1 Get last inserted id
posted by admin on April 5, 2016
I want to get my new inserted row id after save

if ($model->save) :
//Do something with my new id
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

/* ру */
return array(
'Username'=>'Имя пользователя',

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

/* ру */
return array(

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


Yii::t('app', 'Username')//app - app.php, 'Username' - the word, which you want to translate
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 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><a href="#">Register</a>

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(
array('label'=>'Signin', 'url'=>array('/site/signin')),
array('label'=>'Register', 'url'=>array('/site/register'))
)); ?>
Read more
Resolved: Convert an associative array to a simple array of its values in php
posted by admin on April 7, 2016
I would like to convert the array:

Array (
[category] => category
[post_tag] => post_tag
[nav_menu] => nav_menu
[link_category] => link_category
[post_format] => post_format


array(category, post_tag, nav_menu, link_category, post_format)
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


It working only from controller. I want to redirect from modelRead more
Resolved: Yii cjuidatepicker not saving
posted by admin on January 30, 2016
I have this field in my _form.php

'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
Resolved: Yii2 showScriptName remove index.php Not Found apache
posted by admin on June 2, 2017
I tried to remove index.php from url by many ways, but without results.
My OS is Ubuntu Linux.
Server Apache.
In web.php in config directory

$config = [
'components' => [
'urlManager' => [
'class' => 'yii\web\UrlManager',
'enablePrettyUrl' => true,
'showScriptName' => false,
'rules' => [
'/' => 'site/index',
'login' => 'site/login',
'<controller:\w+>/<id:\d+>' => '<controller>/view',
'<controller:\w+>/<action:\w+>/<id:\d+>' => '<controller>/<action>',
'<controller:\w+>/<action:\w+>' => '<controller>/<action>',

Still not working
I try to created .htaccess in web direcory

RewriteEngine on
# If a directory or a file exists, use it directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Otherwise forward it to index.php
RewriteRule . index.php

Still without result
In result
404 Not Found

Not Found

The requested URL /login was not found on this server.

Apache/2.4.18 (Ubuntu) Server at tracker.dev Port 80

Please help me to resolve problemRead 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)),
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(
'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\'))',

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