Posts Tagged with yii

Displaying 61-70 of 110 results.
Resolved: Yii sum criteria select condition
posted by admin on April 15, 2016
I try to count my views sum count, by this way

$criteria=new CDbCriteria;
$criteria->select='SUM(visits) as SUMvisits';
$criteria->condition='media_id=:media_id';
$criteria->params=array(':media_id'=>$media_id);
$sBalance = Views::model()->find($criteria)->getAttribute('SUMvisits');
var_dump($sBalance);exit();


Something like this, but it is not workingRead 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 - active class not rendering
posted by admin on April 12, 2016

'items'=>array(
array(
'label'=>'About',
'url'=>array('/contact')
),


My CMenu not generate active class.Read more
Wiki: Yii 1.1: Add id or class to CMenu itemswiki
posted by admin on April 12, 2016
CMenu comes with a lot of great customization options built in. One of the most used is the class 'active' being added to menu item. But, what if you want to add your own class or id to a menu item ?

It's very easy, you just need to use the 'itemOptions'.

If you want a menu like :

<ul id="myMenu">
<li id="first"><a href="#"><span>First</span></a></li>
<li id="second"><a href="#"><span>Second</span></a></li>
</ul>


Just do :

<?php $this->widget('application.components.MyMenu', array(
'id' => 'myMenu',
'items' => array(
array('label' => 'First', 'url' => array('#'), 'itemOptions'=>array('id' => 'first'), ),
array('label' => 'First', 'url' => array('#'), 'itemOptions'=>array('id' => 'second'), ),
),
));
?>
Read more
Resolved: Yii translation not working
posted by admin on April 12, 2016
My Yii app translation code is stop working

<?php echo Yii::t('t', 'Added'); ?>


My Messages folder and file:

- messages
- ru
- t.php
Read more
Resolved: Yii file save error Directory must be writable
posted by admin on April 11, 2016
I have form, and I create directory by mkdir

mkdir($mydirectory, 0777, true);


And got an error during save my file, which I try to upload from my _form.php

Directory must be writable
Read more
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 get last parameter from current url without GET name getQuery
posted by admin on April 10, 2016
My controller

public function actionVideo()
{
//want to get last url parametr
}


My URL like

...video/12313213123/dubaivideos


I want to get dubaivideosRead more
Wiki: Yii 1.1: videojswiki
posted by admin on April 9, 2016
EVideoJS extends CWidget and implements a base class for the VideoJS player.

EVideoJS extends CWidget and implements a base class for the VideoJS HTML5 Video Player.

Tested with Yii Framework v.1.1.6 and VideoJS 1.3.0.

Support: http://www.yiiframework.com/forum/index.php?/topic/16592-evideojs/

Installation
Extract the videojs folder under protected/extensions.

Usage
The bare minimum configuration needs:
  • video_mp4 URL
  • width
  • height


The code below shows common usage and options defaults.


$this->widget('application.extensions.videojs.EVideoJS', array(
'options' => array(
// Unique identifier, is autogenerated by default, useful for jQuery integrations.
'id' => false,
// Video and poster width in pixels
'width' => 320,
// Video and poster height in pixels
'height' => 240,
// Poster image absolute URL
'poster' => false,
// Absolute URL of the video in MP4 format
'video_mp4' => false,
// Absolute URL of the video in OGV format
'video_ogv' => false,
// Absolute URL of the video in WebM format
'video_webm' => false,
// Use Flash fallback player ?
'flash_fallback' => true,
// Address of custom Flash player to use as fallback
'flash_player' => 'http://releases.flowplayer.org/swf/flowplayer-3.2.1.swf',
// Show controls ?
'controls' => true,
// Preload video content ?
'preload' => true,
// Autostart the playback ?
'autoplay' => false,
// Show VideoJS support link ?
'support' => true,
// Show video download links ?
'download' => true,
),
));


Resources
VideoJS official web site: HTML5 Video Player

Download
videojs.zipRead more
Resolved: Yii 1.1 CGridView Error 500 Trying to get property of non-object
posted by admin on April 8, 2016
I have CGridView with relation

admin.php in Media view

<?php $this->widget('zii.widgets.grid.CGridView', array(
'id'=>'media-grid',
'dataProvider'=>$model->search(),
'filter'=>$model,
'columns'=>array(
'id',
'caption',
array(
'name' => 'gallery_id',
'value' => '$data->gallery->name',
'filter' => CHtml::listData(Gallery::model()->findAll(), 'id', 'name'),
),
),
array(
'class'=>'CButtonColumn',
),
),
)); ?>


Gallery.php Model

class Gallery extends CActiveRecord
{
. . .
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(
. . .
'gallery' => array(self::HAS_MANY, 'Media', 'gallery_id'),
);
}
. . .
}


Media.php Model

class Media extends CActiveRecord
{

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(
. . .
'gallery' => array(self::BELONGS_TO, 'Gallery', 'gallery_id'),
);
}
}


I see this error

Error 500
Trying to get property of non-object


Error in line

'value' => '$data->gallery->name',
Read more