Hello. I’m English bad. I’m learning a new yii framework.How do I resolve the error I’m getting.
controller/uyeConroller.php
<?php
class UyeController extends Controller
{
public function actionArama()
{
$sonuc = Uyeler::model()->findAll();
$this->render('arama', array('sonuc'=> $sonuc));
}
public function actionEkle()
{
$iller = new Iller();
$this->render('ekle', array('iller'=>$iller));
}
public function actionIlcesec()
{
$data = Ilceler::model()->findAll('ilID=:ilID',
array(':ilID'=>$_POST['ilID']));
$data= CHtml::listData($data,'ilceID','ad');
echo "<option value=''>Ilceler</option>";
foreach($data as $value=>$name)
echo CHtml::tag('option', array('value'=>$value),CHtml::encode($name),true);
}
public function actionGuncelle()
{
$this->render('guncelle');
}
public function actionIndex()
{
$this->render('index');
}
// Uncomment the following methods and override them if needed
/*
public function filters()
{
// return the filter configuration for this controller, e.g.:
return array(
'inlineFilterName',
array(
'class'=>'path.to.FilterClass',
'propertyName'=>'propertyValue',
),
);
}
public function actions()
{
// return external action classes, e.g.:
return array(
'action1'=>'path.to.ActionClass',
'action2'=>array(
'class'=>'path.to.AnotherActionClass',
'propertyName'=>'propertyValue',
),
);
}
*/
}
wiev/ekle.php
<?php
/* @var $this UyelerController */
/* @var $model Uyeler */
?>
<?php
echo "<div style='width:120px; float: left'>";
$chtml=new CHtml;
echo $chtml::beginForm('#','post');
echo "Üye No:";
echo "<br/>";
echo $chtml::textField('uye_id');
echo "<br/>";
echo "Adı:";echo "<br/>";
echo $chtml::textField ('adi');
echo "<br/>";
echo "Soyadı:";
echo "<br/>";
echo $chtml::textField ('soyadi');
echo "<br/>";
echo "Doğum Yeri";
echo "<br/>";
echo $chtml::textField ('dogum_yeri');
echo "<br/>";
echo "Doğum Tarihi:";
echo "<br/>";
// tarih seçmek için
$this->widget('zii.widgets.jui.CJuiDatePicker',array(
'name'=>'dogum_tarihi',
// additional javascript options for the date picker plugin
'options'=>array(
'showAnim'=>'fold',
'language' => 'tr',
'dateFormat' => 'yy-mm-dd', //save to db format
'altFormat' => 'dd/mm/yy', // show to user format
),
'htmlOptions'=>array(
'style'=>'height:20px;'
),
));
echo "<br/>";
echo "Nüfusa Bağlı Olduğu İl:";
echo "<br/>";
echo $chtml::dropDownList($iller,'ad',CHtml::listData(Iller::model()->findAll(
array('order' => 'ilID')),'ilID','ad'),
array(
'prompt'=>'İl Seçiniz',
'ajax'=>array(
'type'=>'POST',
'url' => CController::createUrl('Ilcesec'),
'data'=> array('ilID'=>'js:this.value'),
'update'=>'#Ilceler',))
);
// İlçelerin listesini dropdownlistte gösteriyor.
echo "<br/>";
echo "Nüfusa Bağlı Olduğu İlçe:";
echo "<br/>";
echo $chtml::dropDownList('Ilceler','', array(),
array('prompt'=>'ilce seciniz')); // İlçelerin listesini dropdownlistte gösteriyor.
echo "<br/>";
echo "Anne Adı:";
echo "<br/>";
echo $chtml::textField ('anne_adi');
echo "<br/>";
echo "Baba Adı:";
echo "<br/>";
echo $chtml::textField ('baba_adi');
echo "<br/>";
echo "</div>";
echo "<div style='width:150px; margin-left: 100px; float: left'>";
echo "Telefon";
echo "<br/>";
echo $chtml::textField ('Tel');
echo "<br/>";
echo "Kan Grubu";
echo "<br/>";
echo $chtml::DropDownList('kan_grubu','',array('1'=>'A Rh (+)','2'=>'A Rh (-)','3'=>'B Rh (+)','4'=>'B Rh (-)','5'=>'AB Rh (+)','6'=>'AB Rh (-)','7'=>'0 Rh (+)','8'=>'0 Rh (-)'),array('empty' =>('Kan Grubu Seçiniz') )); // Kan Grubu listesini dropdownlistte gösteriyor.
echo "<br/>";
echo "Cinsiyet:";
echo "<br/>";
echo $chtml::DropDownList('cinsiyet','',array('0'=>'Erkek','1'=>'Bayan'),array('empty' =>('Cinsiyet Seçiniz') )); // Cinsiyet listesini dropdownlistte gösteriyor.
echo "<br/>";
echo "Adres:";
echo "<br/>";
echo $chtml::textArea('adres');
echo "<br/>";
echo "Adres İli";
echo "<br/>";
//echo $chtml::DropDownList(İlce,'',$liste,array('empty' =>('İlce Seçiniz') )); // İllerin listesini dropdownlistte gösteriyor.
echo "<br/>";
echo "Adres İlçesi:";
echo "<br/>";
//echo $chtml::DropDownList(İl,'',$liste,array('empty' =>('İl Seçiniz') )); // İlçelerin listesini dropdownlistte gösteriyor.
echo "<br/>";
echo "Üye Görevi:";
echo "<br/>";
echo $chtml::DropDownList('uye_gorevi','',array('0'=>'Üye','1'=>'Başkan','2'=>'Başkan Yardımcısı','3'=>'Muhasip','4'=>'Sekreter','5'=>'Yedek Üye'),array('empty' =>('Üyelik Türü Seçiniz') )); // Üye görevi gösteriyor.
echo "<br/>";
echo "Üyelik Tarihi:";
echo "<br/>";
// tarih seçmek için
$this->widget('zii.widgets.jui.CJuiDatePicker',array(
'name'=>'uye_kayit_tarihi',
// additional javascript options for the date picker plugin
'options'=>array(
'showAnim'=>'fold',
'language' => 'tr',
'dateFormat' => 'yy-mm-dd',
'altFormat' => 'dd/mm/yy', // show to user format
),
'htmlOptions'=>array(
'style'=>'height:20px;'
),
));
echo "<br/>";
echo "Üyelik Durumu:";
echo "<br/>";
echo $chtml::DropDownList('uye_durumu','',array('0'=>'Aktif','1'=>'Pasif'),array('empty' =>('Üyelik Durumu Seçiniz') )); // Üyelik durumu dropdownlistte gösteriyor.
echo "<br/>";
echo $chtml::submitButton('Üye Ekle',array('name'=>'ekle'));
echo $chtml::resetButton('İptal',array('name'=>'iptal'));
echo "</div>";
echo "<div style='width: 500px; height: 400px; float: right; background-color: #C9E0ED;'>";
echo "denme";
echo "</div>";
?>
Error page
Recoverable error
Object of class Iller could not be converted to string
D:\wamp\www\yii\framework\web\helpers\CHtml.php(2155)
2143 return call_user_func($attribute,$model);
2144
2145 return $model;
2146 }
2147
2148 /**
2149 * Generates a valid HTML ID based on name.
2150 * @param string $name name from which to generate HTML ID
2151 * @return string the ID generated based on name.
2152 */
2153 public static function getIdByName($name)
2154 {
2155 return str_replace(array('[]','][','[',']',' '),array('','_','_','','_'),$name);
2156 }
2157
2158 /**
2159 * Generates input field ID for a model attribute.
2160 * @param CModel $model the data model
2161 * @param string $attribute the attribute
2162 * @return string the generated input field ID
2163 */
2164 public static function activeId($model,$attribute)
2165 {
2166 return self::getIdByName(self::activeName($model,$attribute));
2167 }
Stack Trace
#0
+ D:\wamp\www\yii\framework\web\helpers\CHtml.php(2155): str_replace(array("[]", "][", "[", "]", ...), array("", "_", "_", "", ...), Iller)
#1
+ D:\wamp\www\yii\framework\web\helpers\CHtml.php(920): CHtml::getIdByName(Iller)
#2
– D:\wamp\www\yii\dernek_yonetim\protected\views\uye\ekle.php(55): CHtml::dropDownList(Iller, "ad", array(1 => "ADANA", 2 => "ADIYAMAN", 3 => "AFYONKARAHİSAR", 4 => "AĞRI", ...), array("prompt" => "İl Seçiniz", "ajax" => array("type" => "POST", "url" => "/yii/dernek_yonetim/index.php?r=uye/Ilcesec", "data" => array("ilID" => "js:this.value"), "update" => "#Ilceler")))
50 'ajax'=>array(
51 'type'=>'POST',
52 'url' => CController::createUrl('Ilcesec'),
53 'data'=> array('ilID'=>'js:this.value'),
54 'update'=>'#Ilceler',))
55 );
56
57 // İlçelerin listesini dropdownlistte gösteriyor.
58 echo "<br/>";
59 echo "Nüfusa Bağlı Olduğu İlçe:";
60 echo "<br/>";
#3
+ D:\wamp\www\yii\framework\web\CBaseController.php(126): require("D:\wamp\www\yii\dernek_yonetim\protected\views\uye\ekle.php")
#4
+ D:\wamp\www\yii\framework\web\CBaseController.php(95): CBaseController->renderInternal("D:\wamp\www\yii\dernek_yonetim\protected\views\uye\ekle.php", array("iller" => Iller), true)
#5
+ D:\wamp\www\yii\framework\web\CController.php(869): CBaseController->renderFile("D:\wamp\www\yii\dernek_yonetim\protected\views\uye\ekle.php", array("iller" => Iller), true)
#6
+ D:\wamp\www\yii\framework\web\CController.php(782): CController->renderPartial("ekle", array("iller" => Iller), true)
#7
– D:\wamp\www\yii\dernek_yonetim\protected\controllers\UyeController.php(18): CController->render("ekle", array("iller" => Iller))
13 public function actionEkle()
14 {
15
16
17 $iller = new Iller();
18 $this->render('ekle', array('iller'=>$iller));
19
20 }
21
22
23 public function actionIlcesec()
#8
+ D:\wamp\www\yii\framework\web\actions\CInlineAction.php(49): UyeController->actionEkle()
#9
+ D:\wamp\www\yii\framework\web\CController.php(308): CInlineAction->runWithParams(array("r" => "uye/ekle"))
#10
+ D:\wamp\www\yii\framework\web\CController.php(286): CController->runAction(CInlineAction)
#11
+ D:\wamp\www\yii\framework\web\CController.php(265): CController->runActionWithFilters(CInlineAction, array())
#12
+ D:\wamp\www\yii\framework\web\CWebApplication.php(282): CController->run("ekle")
#13
+ D:\wamp\www\yii\framework\web\CWebApplication.php(141): CWebApplication->runController("uye/ekle")
#14
+ D:\wamp\www\yii\framework\base\CApplication.php(180): CWebApplication->processRequest()
#15
– D:\wamp\www\yii\dernek_yonetim\index.php(13): CApplication->run()
08 defined('YII_DEBUG') or define('YII_DEBUG',true);
09 // specify how many levels of call stack should be shown in each log message
10 defined('YII_TRACE_LEVEL') or define('YII_TRACE_LEVEL',3);
11
12 require_once($yii);
13 Yii::createWebApplication($config)->run();