Yii

Facebook like Server error 500

落花浮王杯 提交于 2020-01-06 20:04:00
问题 I wanted to add a Facebook like button to one of the pages of my website. However, I'm being bothered by this Server error 500. You see, when I click the Facebook like plugin, it opens up the facebook login box. I enter my login credentials and then the login box disappears and it momentarily displays up my FB profile image beneath the like button on the page. The image then vanishes and it displays a "Confirm" box which when clicked displays this Server 500 error. Below is the code which I

Yii: SQL query for getting the top users for every month and top users at the end of year

一笑奈何 提交于 2020-01-06 20:02:22
问题 I am a yiibie, I have a question that I have a table named user_join_event which has id(PK) ngo_id(FK) event_id(FK) date_created date_modified as objects, and I want to get the 5 users Id's(which are repeated the most in this table) for every month. Like January top 5 users, Feb top 5 users and so on and then the top 5 users at the end of the year from this table, like once the year is completed it should give again the top 5 users from all over the month. Please help me with this, how to

Strange variable overwrite in foreach loop

亡梦爱人 提交于 2020-01-06 19:33:43
问题 This must be something ugly obvious, but I'm stucked on this and can't solve it for past two hours. I have this piece of code: foreach($idMap as $menuId=>$pageId) { echo('$this->update("menus_items", SET "link = /content/show?id='.$pageId.'" WHERE id = '.$menuId.');'."\n"); $this->update ( 'menus_items', array('link'=>'/content/show?id='.$pageId), array('id = '.$menuId) ); } echo part works as expected ( $pageId is different for each item, taken from $idMap ), while Yii's CDbCommand::update()

Use ajax/json in yii framework

梦想与她 提交于 2020-01-06 19:27:44
问题 Im trying to make a webshop in Yii framework. Now i want to unset a session when a user clicks on a icon. I currently have it working that is sends a json call to a file, but the url in the json call is being rewrited by my htaccess i think. JSON call: $(document).ready(function(){ $('.glyphicon-trash').click(function(){ $.getJSON("ajax/load.php?action=unset&element="+$(this).parent(), function(data) { alert(data.message); }); }); }); Error i get: GET http://mydomain.nl/my/path/to/site/ajax

Only time picker in ejuidatetimepicker

时光毁灭记忆、已成空白 提交于 2020-01-06 13:55:33
问题 I'm using ejuidatetimepicker in my Yii application. Its giving date and time picker. I want only time picker, I have tried with two options mode => 'time' and timeOnly=>true . its not working. Please find my below code. $this->widget( 'application.extensions.timepicker.EJuiDateTimePicker', array( 'model' => $model, // Your model 'attribute' => 'starttime', // Attribute for input //'mode'=>'time', //Not working Error Message is "Property "EJuiDateTimePicker.mode" is not defined. " //timeOnly -

Join tables using model in Yii2

隐身守侯 提交于 2020-01-06 09:06:12
问题 this is table1 id1 Name ------------ 1 value1 2 value2 this is table2 id2 Name id1 --------------------- 1 value1 2 2 value2 1 this is table3 id3 Name id2 --------------------- 1 value1 2 2 value2 1 this is table4 id4 Name id3 --------------------- 1 value1 2 2 value2 1 I Want to join above 4 tables in Yii2 with model select * from table1 left join table2 on table2.id2 = table1.id1 left join table3 on table2.id3 = table1.id2 left join table4 on table2.id4 = table1.id3 回答1: 1. Use Yii2

Join tables using model in Yii2

这一生的挚爱 提交于 2020-01-06 09:06:06
问题 this is table1 id1 Name ------------ 1 value1 2 value2 this is table2 id2 Name id1 --------------------- 1 value1 2 2 value2 1 this is table3 id3 Name id2 --------------------- 1 value1 2 2 value2 1 this is table4 id4 Name id3 --------------------- 1 value1 2 2 value2 1 I Want to join above 4 tables in Yii2 with model select * from table1 left join table2 on table2.id2 = table1.id1 left join table3 on table2.id3 = table1.id2 left join table4 on table2.id4 = table1.id3 回答1: 1. Use Yii2

Join tables using model in Yii2

南楼画角 提交于 2020-01-06 09:05:20
问题 this is table1 id1 Name ------------ 1 value1 2 value2 this is table2 id2 Name id1 --------------------- 1 value1 2 2 value2 1 this is table3 id3 Name id2 --------------------- 1 value1 2 2 value2 1 this is table4 id4 Name id3 --------------------- 1 value1 2 2 value2 1 I Want to join above 4 tables in Yii2 with model select * from table1 left join table2 on table2.id2 = table1.id1 left join table3 on table2.id3 = table1.id2 left join table4 on table2.id4 = table1.id3 回答1: 1. Use Yii2

Yii::app()->getModule('user') is not returning the right value view/layout/main.php

戏子无情 提交于 2020-01-06 08:00:51
问题 Yii::app()->getModule('user') is not returning the right value in view/layouts/main.php I am using Yii-User YII-User Extension to manage the User related features. When I Yii::app()->getModule('user')->loginUrl, I get Trying to get property of non-object at array('url'=>Yii::app()->getModule('user')->loginUrl, 'label'=>Yii::app()->getModule('user')->t("Login"), 'visible'=>Yii::app()->user->isGuest), Pls tell me whats going wrong, is it a known issue or something like that. Here is the config

Add comments in post yii

烈酒焚心 提交于 2020-01-06 07:29:07
问题 I am trying to add comment module in my blogging website . What I have done is : No 1 Add a <div> in Blog post view.php to render tblcomments/_form <?php $model_comments = new TblComments; $this->renderPartial('/TblComments/_form',array( 'comments'=>$model_comments, )); ?> No 2 : This is my TblComments/_form.php < div class="form"> <?php $form=$this->beginWidget('CActiveForm', array( 'id'=>'tbl-comments-form', 'enableAjaxValidation'=>false, )); ?> <p class="note">Fields with <span class=