Yii

How to make user profile link like facebook for my web page [closed]

折月煮酒 提交于 2019-12-20 03:52:48
问题 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 7 years ago . I am developing a web page using Yii framework, I want to do url management like facebook. This is my url www.mywebpage.com/user/profile/id/10 but i dont want to show this url like this, i would like to show like

conditional statements inside of 'value' for CDataColumn

时光毁灭记忆、已成空白 提交于 2019-12-20 03:32:33
问题 Does anyone know how to display a conditional value in CGridView column field? I've got an entry in the DB for gender 'M' of 'F', in die CGridView however I would like to display 'Male' and 'Female' respectively and not M or F. Any ideas would be welcome ;-) 回答1: I have found that while full if/else syntax is not allowed, you can use the shorthand syntax. Something like this: array( 'name'=>'column_name', 'type'=>'HTML', 'value'=>'($data->gender=="M")?"Male":"Female"', ), I think you can do

condition in criteria in yii framework php

梦想与她 提交于 2019-12-20 03:26:16
问题 $criteria=new CDbCriteria(); $criteria->with = array('reviewCount', 'category10', 'category20', 'category30', 'town'); $criteria->select = 't.id,business,street,postalCode,contactNo,checkinCount,count(tbl_abc.id) as spcount'; $criteria->join = 'left join tbl_abc on t.id=tbl_abc.businessId'; $criteria->group = 't.id'; $criteria->order = 'spcount DESC'; $criteria->condition='spcount>1'; $bizModel = new CActiveDataProvider(Business::model(), array( 'criteria' => $criteria )); I'm getting this

how to create custom autocomplete textfield in yii

橙三吉。 提交于 2019-12-20 03:09:26
问题 I am new to yii. I need to write custom yii auto complete.I knew that CJuiAutocomplete is there.but I need to implement own custom auto complete. can anyone pls guide me or help me to develop custom autocomplete textfield. taking the id while displaying name in the textfield. Thanks in advance 回答1: Here is an action in site controller... public function actionAutoComplete($term){ $query = Yourmodel::model()->findallbyattributes( array('somecolumn'=>$term)); $list = array(); foreach($query as

Yii - How to access to model and call action in yiic

半世苍凉 提交于 2019-12-20 02:59:17
问题 I have an action that prints "Hello World": public function actionStart() { echo 'Hello World'; } I will to run a cron job that calls this action every minute. How I can do this with yiic ? UPDATE: I create console app. I have cron.php inside index.php: <?php defined('YII_DEBUG') or define('YII_DEBUG',true); // including Yii require_once('framework/yii.php'); // we'll use a separate config file $configFile='protected/config/c.php'; // creating and running console application Yii:

Controlling url in Yii: controller/action/id to /id

我们两清 提交于 2019-12-20 02:56:08
问题 Can we display url in the format controller/action/id to /id in Yii? Also, one major problem is that I need to do this only on the specific controller/action. For Instance: If I have /user/post/ujjwal then I need to show /ujjwal only. And when I have /image/display/ujjwal then it can be as it is? I have read the url management in Yii and understand whatever is shown in there. But I dont' know how to control the url based on the controller/action . Any help would be appreciated. Thanks, Ujjwal

Yii URL Management HTTPS

戏子无情 提交于 2019-12-20 02:26:16
问题 Im using a code to separate pages that is HTTPS and HTTP in my website The problem is: When Im on HTTP, links to HTTPS no have WWW and vice versa. I did not find the problem in the script. public function createUrl($route, $params = array(), $ampersand = '&') { $url = parent::createUrl($route, $params, $ampersand); // If already an absolute URL, return it directly if (strpos($url, 'http') === 0) { return $url; } // Check if the current protocol matches the expected protocol of the route // If

creating background processes in php for long running process

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-20 01:45:40
问题 Ok so forgive me if this is a repeat of another question, but after searching I have not found a clear answer. What I basically want to do is have my php web application fire off some event (like an emailer or report generator) that may take a few minutes to complete and immediately return control to the page. I come from a .NET world where this can easily be accomplished with a thread. So here's the workflow: User clicks 'generate Report' button ajax call made to '../blah/generate-report'

Count all record in table in yii2 without where clause

老子叫甜甜 提交于 2019-12-20 01:39:03
问题 I want to count all record from table without specify any condition : now, i am doing by this way $result['cms'] = Cms::find()->where([])->count(); and it will give me result,but i don't want to use where clause. So how to count all records without where clause. Thank you 回答1: You can see this doc http://www.yiiframework.com/doc-2.0/yii-db-activequery.html simply using count(): returns the result of a COUNT query. Cms::find()->count(); all(): returns an array of rows with each row being an

RegisterPackage depends on RegisterScriptFile

落爺英雄遲暮 提交于 2019-12-20 01:07:17
问题 I have a package that requires Google Map library. And I implemented it like this in the view. <?php Yii::app()->clientScript->registerScriptFile('http://maps.googleapis.com/maps/api/js?sensor=false&language=' . Yii::app()->language . '&region='.Yii::app()->language, CClientScript::POS_HEAD); ?> <?php Yii::app()->clientScript->registerPackage('somelibrary'); ?> (Note that the Google Map library needs a parameter Yii::app()->language ). But in the output, the package is always placed above the