Questions tagged [yii1.x]

Old version of PHP framework Yii.

Yii Framework

Yii is a generic Web programming framework, meaning that it can be used for developing all kinds of Web applications using PHP. Because of its component-based architecture and sophisticated caching support, it is especially suitable for developing large-scale applications such as portals, forums, content management systems (CMS), e-commerce projects, and so on.

Yii 1 is the first version of the Yii framework. Yii 1.0 was released in December 2008 and it is no longer supported. Yii 1.1 was released in January 2010 and reached the end of life in November 2015. Since then it only receives security bugfixes and fixes that improve compatibility with new versions of PHP. In October 2014 the successor of Yii 1.1 was released: .

Official documentation can be found in the Definitive Guide to Yii 1.1. Further important resources:

270 questions
38
votes
2 answers

addColumn yii migration position

I want to add a column at the seventh place in the table, I am using $this->addColumn('table_name','column_name','type'); adds the column at the end. Is there any way where I can mention the place to add column? Or any after column keyword to add…
dibs_ab
  • 723
  • 2
  • 13
  • 24
36
votes
8 answers

yii: how to make a unique rule for two attributes

I have a table like this: (id, name, version, text). (name, version) is unique key, how can i make a rule to validate this.
li meirong
  • 363
  • 1
  • 3
  • 4
32
votes
8 answers

Get current controller and action id in Yii

I want to force all users to log in before accessing pages of my site. I have followed Larry Ullman's tutorial Forcing Login for All Pages in Yii. According to the tutorial you can make an exception for some pages to avoid redirecting to the log in…
Hamid Ghorashi
  • 1,003
  • 3
  • 14
  • 29
29
votes
2 answers

render a view from another controller, yii

The controller: controllers |-FooController.php |-BarController.php The views: view |-foo| | |-index.php | |-error.php | |-bar| |-index.php How to render the error.php view with an action of the bar controller? I have…
Cedric
  • 5,135
  • 11
  • 42
  • 61
28
votes
8 answers

Basic Hidden field in yii

I'm trying to place data in hidden text in yii, but I don't know how. I need a similar code to a regular php syntax: It's supposed to be a field with static value of a. I just need it to go with…
marchemike
  • 3,179
  • 13
  • 53
  • 96
24
votes
2 answers

Yii multi page form wizard best practice

I am trying to build a multi-page form with Yii, but am quite new to PHP and Yii and am wondering what the best practice is for writing a multi page form. So far, what I am planning to do is to add a hidden field named 'step' which contains the…
Stinky Tofu
  • 475
  • 2
  • 5
  • 11
10
votes
4 answers

How to bind array parameters in Yii framework?

I have below code: $inputs = "1,2,3,4,5"; $sql = "SELECT * FROM obj WHERE id IN(:input)"; $commond = Yii::app()->db->createCommand($sql); $commond->bindValue(":input", $inputs , PDO::PARAM_STR); But the query result is incorrect. How to bind…
Cherry
  • 388
  • 1
  • 3
  • 13
10
votes
2 answers

How add CJuiDatePicker in JQRelcopy on Yii Framework

I have a problem with CJuiDatePicker in the module JQRelcopy on Yii framework. I use this module as I have a form with a datepicker field to be copied as many times as the user wishes. The module works fine if I put a normal field (without…
Florent
  • 761
  • 1
  • 10
  • 24
9
votes
1 answer

How to add list to the loaded template in phpword

I used PHPword to create a word document in my web application but I coud not implement list. I used the following code: $PHPWord = new PHPWord(); $temp = $PHPWord->loadTemplate('temp.docx'); $section =…
yiideveloper
  • 121
  • 1
  • 6
7
votes
4 answers

Batch insert in Yii

I need to insert multiple ActiveRecord object in Yii,if all of them inserted $transaction = Yii::app()->db->beginTransaction(); for ($i = 0;$i < 10;$i++){ $model = new Mymodel(); $model->x = $i; if (!$model->save()){ …
Moein Hosseini
  • 4,309
  • 15
  • 68
  • 106
7
votes
1 answer

Using transaction in a loop in Yii

I have an array of active records and want to change some field of them with a loop in this manner: $error = false; foreach ($items as $item) { $item->is_paid = self::PENDING; $error = $error || !$item->save(); } return $error; What I…
hamedkh
  • 909
  • 3
  • 18
  • 35
7
votes
5 answers

Get base URL in Yii console application

How to get base URL in a Yii CConsoleApplication application? I tried Yii::app()->request->getBaseUrl(true) and ended up with the following error. Undefined index: SERVER_NAME (/var/www/yii/framework/web/CHttpRequest.php:279)
Harish Ambady
  • 12,525
  • 4
  • 29
  • 54
5
votes
2 answers

How to write this html part in CGridView Yii1.1

This is the column(It is a numerical input with range of numbers between 1 and 60), that I want to add into CGridView, but I want to append terminalcode to the id of this input. In this code everything is working properly, but terminalcode is not…
lakru-one
  • 139
  • 8
5
votes
3 answers

Url manager and Htaccess in Yii1

I have url like this: www.studyenglish/index.php?r=site/lesson&act=read&id=1 I would like change to be: www.studyenglish/site/lesson/read I have added this script in url manager config/main.php 'urlManager'=>array( .... …
4
votes
2 answers

Calling unknown method: yii\web\Application::createUrl() in yii2

I have worked in Yii1 and now I'm trying to use Yii2. I have installed composer and then installed basic app. But now i am getting this error when i try to access the basic app. Can anyone help me how to solve this issue? Error is: Calling unknown…
Shamon S
  • 127
  • 1
  • 8
1
2 3
17 18