and here’s what i got, the default layout and colors dissappeared,
by the way, my cities table and the other 2 doesn’t have a primary key on their tables, they are stand alone…does that has something to do with why my app turned to white just like that after I added the listData ?
One more thing, is cities or Cities a model? Why is called cities? wouldn’t be city? or City? (I recommend you call the model class as their names states as in Windows environment won’t be a problem but in Linux if your class is saved as City.php Yii won’t find it)
How is your table structured (city or cities), just to provide you with a better answer.
that ‘City’ inbetween the $model and CHtml, should I replace it with the ‘CityID’ attribute of the Cities model ?
or just leave it like that?, because I’m pulling the cities data from the Cities model and it is a separate model from the script view who’s trying to use this CHtml helper … (i don’t really know how this thing works despite of reading the dropDownList/listData manual )
I actually checked my php.ini file, all error related stuff is ‘on’ ever since, my YII debug is on, including
the log thing from the main.php file…
this one works, as per the Company model + the it’s City Attribute, it showed a blank text field as expected
<?php echo $form->textField($model,'City'); ?>
this one doesn’t., it showed a white page only
I checked my php_error log, this is what I found out
it doesn’t retrieve anything, it still white page.
by the way, my Cities Table has Cities model only, it doesn’t have a CRUD nor Controller generated from gii,
do you think the crud and controller does matter ? or the model alone should be enough to pull datas from that table ?
this is the contents of the cities model ( i masked the real model name )
* This is the model class for table "Cities".
* The followings are the available columns in table 'cities':
* @property integer $CountryID
* @property integer $RegionID
* @property integer $StateID
* @property integer $CityID
* @property string $CityCode
* @property string $CityName
* The followings are the available model relations:
class Cities extends CActiveRecord
* Returns the static model of the specified AR class.
* @return Cities the static model class
public static function model($className=__CLASS__)
* @return string the associated database table name
public function tableName()
* @return array validation rules for model attributes.
public function rules()
// NOTE: you should only define rules for those attributes that
// will receive user inputs.
array('CountryID, RegionID, StateID, CityID', 'numerical', 'integerOnly'=>true),
array('CityCode', 'length', 'max'=>10),
array('CityName', 'length', 'max'=>50),
// The following rule is used by search().
// Please remove those attributes that should not be searched.
array('CountryID, RegionID, StateID, CityID, CityCode, CityName', 'safe', 'on'=>'search'),
* @return array relational rules.
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 customized attribute labels (name=>label)
public function attributeLabels()
'CountryID' => 'Country',
'RegionID' => 'Region',
'StateID' => 'State',
'CityID' => 'City',
'CityCode' => 'City Code',
'CityName' => 'City Name',
* Retrieves a list of models based on the current search/filter conditions.
* @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
public function search()
// Warning: Please modify the following code to remove attributes that
// should not be searched.
return new CActiveDataProvider(get_class($this), array(
I did your suggestion., the page color went back to normal, but the ‘City’ field is blank (ofcourse)
but the var_dump(Cities::model()->findAll());
is blank too.
ok, the real table name is gg_t_worldareascities and the real model name generated from gii is GgTWorldareascities ( do you think it causes the problem ?, i mean, the real table name got underscores and the generated model from gii doesn’t have )
The table name is not causing the problem, with you have done we have isolated the problem and we know now that there is no problems with your dropdown list but with your findAll()… Now, lets see its SQL.
In order to view the SQL, we are going to activate CWebLogRoute in your config/main.php file:
I also tried generating another model version wherein, I typed the gg_t as prefix inside the gii prefix box of the model generator…the model generated was Worldareascities…but still same thing happened