Yii

dependent dropdown box with Yii

这一生的挚爱 提交于 2020-01-03 01:13:48
问题 i have a countries, states, cities tables , and I need 3 dropdown menus wherein, if i select a country like e.g United States, the states dropdown menu will automatically show only the states that are under United States, and next, if I select a State like e.g California, the Cities drop down menu will only show off the Cities under California am currently having problem implementing this in yii. I have this _form file where these 3 dropdown should be included. I have a partial code, but I

dependent dropdown box with Yii

旧城冷巷雨未停 提交于 2020-01-03 01:13:26
问题 i have a countries, states, cities tables , and I need 3 dropdown menus wherein, if i select a country like e.g United States, the states dropdown menu will automatically show only the states that are under United States, and next, if I select a State like e.g California, the Cities drop down menu will only show off the Cities under California am currently having problem implementing this in yii. I have this _form file where these 3 dropdown should be included. I have a partial code, but I

Display images from protected folder

风格不统一 提交于 2020-01-03 00:02:08
问题 I have a protected folder within Yii and I'm looking to display some of those images within the site. I've tried the following code and it works within the site/index controller in that it returns just the image I wanted. However when I tried to separate the code it didn't work. Any help is appreciated. Model public function getImage() // will take file identifier as @param { $imageID = '2562584569'; // will eventually be dynamically assigned $image = Images::model()->find('tmp_name=:id',

Yii2 获取URL的一些方法

前提是你 提交于 2020-01-02 13:29:09
1. 获取url中的host信息: 例如:http://www.nongxiange.com/product/2.html Yii::$app->request->getHostInfo(); 结果:http://www.nongxiange.com 2. 获取url中的路径信息(不包含host和参数): 例如:http://www.nongxiange.com/product/2.html?isnew=1 Yii::$app->request->getPathInfo() 结果:product/2.html 3. 获取不包含host信息的url(含参数): 例如:http://www.nongxiange.com/product/2.html?isnew=1 Yii::$app->request->url 结果:product/2.html?isnew=1 4. 获取完整url(含host以及参数): 例如:http://www.nongxiange.com/product/2.html?isnew=1 Yii::$app->request->getHostInfo().Yii::$app->request->url; 结果:http://www.nongxiange.com/product/2.html?isnew=1 5.只想获取url中的参数部分: 例如:http:/

best way for next/previous buttons for entries in yii

孤者浪人 提交于 2020-01-02 06:59:12
问题 I would like to know what is the best way to create next/previous buttons for an entry in the database. Let's say we have a table with images and every image has an ID and a Path. If the current image has ID equal to "9" how can I get the next and the previous IDs? I already found a solution for this right here https://stackoverflow.com/a/8874382 but this seems to be the latest choice. If we have over 10000 entries (images) in our database, this will overwhelm the server. First of all, it

jQuery(…).yiiGridView is not a function

泪湿孤枕 提交于 2020-01-02 05:05:07
问题 I have a problem with Yii grid view. for some reason it does not seem to load correctly, even though the script is included (i can see it in the source code). This is the header part of the HTML: <script src="fileadmin/static/js/jquery-1.8.3.min.js" type="text/javascript"></script> <script src="/module/public/assets/80c0553/gridview/jquery.yiigridview.js" type="text/javascript"></script> <script type="text/javascript">jQuery(function($) { jQuery('#grid-downloads').yiiGridView({'ajaxUpdate':[

Call static method from a string name in PHP

天大地大妈咪最大 提交于 2020-01-02 00:55:10
问题 I need to call a static method of a class, but I only have a classname, not an instance of it. I am doing it this way. $class = new "ModelName"; $items = $class::model()->findAll(); It works on my computer, but when I move to the server, it throws an unexpected T_PAAMAYIM_NEKUDOTAYIM , so I think it actually expects model to be a variable instead of a method. PS: If it helps, it's Yii framework, so if there's another way to call the find() functions, it's ok to me. Thanks in advance 回答1: This

Display custom layout in autocomplete in Yii

南楼画角 提交于 2020-01-01 22:18:51
问题 My problem is, I want to customize the drop-down list of autocomplete.Below is my tried code but it is not displaying as I want. <?php $this->widget('zii.widgets.jui.CJuiAutoComplete', array( 'name'=>'autoComplete', 'value'=>'', 'source'=>$this->createUrl('post/search'), // additional javascript options for the autocomplete plugin 'options'=>array( 'showAnim'=>'fold', ),'htmlOptions'=>array( //'onfocus' => 'js: this.value = null; $("#searchbox").val(null); $("#selectedvalue").val(null);',

yii : how to ajax update the cgridview

依然范特西╮ 提交于 2020-01-01 19:44:30
问题 Q : How to ajax update the CgridVeiw? Status : I've done with cookie. but there are a problem. it is when the page upload, the date are always show in from-date and to-date text box. and When reload the page, it doesn't clear out. This is my view <?php $form=$this->beginWidget('CActiveForm', array( 'id'=>'page-form', 'enableAjaxValidation'=>true, )); ?> <div style="margin-top:30px;"> <b>From :</b> <?php $this->widget('zii.widgets.jui.CJuiDatePicker', array( 'name'=>'from_date', // name of

Yii - create temporary table and using it in next query produces General error: 2014 Cannot execute queries while other unbuffered queries are active

泪湿孤枕 提交于 2020-01-01 19:06:02
问题 I am creating temporary table to hold some dates in first query. And in second query I try to join with those dates... and than i get following error: SQLSTATE[HY000]: General error: 2014 Cannot execute queries while other unbuffered queries are active. Consider using PDOStatement::fetchAll(). Alternatively, if your code is only ever going to run against mysql, you may enable query buffering by setting the PDO::MYSQL_ATTR_USE_BUFFERED_QUERY attribute.. First query: $query = "DROP TABLE if