Yii Framework Forum: Aik Modle Se Dosre Say Dosre Modle Ke Member Funcin Ko Kasay Call Karen - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Aik Modle Se Dosre Say Dosre Modle Ke Member Funcin Ko Kasay Call Karen

#1 User is offline   Khandad Niazi 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 15-October 12

Posted 10 January 2013 - 01:42 PM

masal ke tor pay mery pass two models hean propery and category ager mean property ke form per category ke dropdwon show karna chata hon to ye kass hoga

for example mean nay category ke modle mean aik functin banay hea like

  public function getCategoryList()
	{
			$c= new CDbCriteria;
			$c->select = 'catId, catName';
			$c->from = 'af_categories';
			$c->order = 'catName ASC';
			$category =	Categories::model()->findAllByPk($c);
			return $category;
	}


and isko mean call karta hon
property ke model pay

<div class="row">
		<?php echo $form->labelEx($model,'fkcategroyid'); ?>
		
		  <?php echo $form->dropDownList($model,'fkcategroyid', $model->categories->getStateList()); ?>
		<?php echo $form->error($model,'fkcategroyid'); ?>
	</div>


to fatal error show karta how how can i solve it

thanks in advance
0

#2 User is offline   PeRoChAk 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 573
  • Joined: 26-November 10
  • Location:Lahore, Pakistan

Posted 16 January 2013 - 11:49 PM

urdu forum main khush amdeed

Darsal app aik cheez missing kr rahay ho wo ya kay dropDownlist main jo teesra argument hota hia wo array main key=>value based hota hia

to, app ka correct code kuch es tarha sy ho ga
<?php echo $form->dropDownList($model,'fkcategroyid', CHtml::listData($model->categories->getStateList(),'id','name')); ?>


Dossri baat ya hia ky app ko model ka jo function app call kr rahay hian wo (getStateList()) hia jub ky jo function app uper kh rahay hian wo getCategoryList hia.

main ya suggest krta hon ky app es ko es terha sy kr lian

<?php echo $form->dropDownList($model,'fkcategroyid', CHtml::listData(Categories::model()->findAll(),'catId','catName')); ?>

Aur ager app phr b relation sy ($model->categories->getCategoriesList()) sy krna cha rahay hian to us ka sahi code kuch youn banta hia


// function in categories model
public function getCategoryList()
{
$c= new CDbCriteria;
$c->select = 'catId, catName';
$c->from = 'af_categories';
$c->order = 'catName ASC';
$category = Categories::model()->findAll($c);
return $category;
}


Shukria
Cheers
Perochak
Web Design - Logo Design - Application Development

My Blog | Forums Comparison
1

#3 User is offline   Kashif Nadeem 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 8
  • Joined: 04-May 12

Posted 16 May 2013 - 07:49 AM

try this one
or visit www do yiitutorial do com

View PostKhandad Niazi, on 10 January 2013 - 01:42 PM, said:

masal ke tor pay mery pass two models hean propery and category ager mean property ke form per category ke dropdwon show karna chata hon to ye kass hoga

for example mean nay category ke modle mean aik functin banay hea like

  public function getCategoryList()
	{
			$c= new CDbCriteria;
			$c->select = 'catId, catName';
			$c->from = 'af_categories';
			$c->order = 'catName ASC';
			$category =	Categories::model()->findAllByPk($c);
			return $category;
	}


and isko mean call karta hon
property ke model pay

<div class="row">
		<?php echo $form->labelEx($model,'fkcategroyid'); ?>
		
		  <?php echo $form->dropDownList($model,'fkcategroyid', $model->categories->getStateList()); ?>
		<?php echo $form->error($model,'fkcategroyid'); ?>
	</div>


to fatal error show karta how how can i solve it

thanks in advance

0

#4 User is offline   farrukhbrains 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 3
  • Joined: 13-June 13

Posted 19 June 2013 - 01:23 PM

Main Yii Framework main Naya Hoo Main login ko kis tarah database kay saat connect karo
0

#5 User is offline   PeRoChAk 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 573
  • Joined: 26-November 10
  • Location:Lahore, Pakistan

Posted 19 June 2013 - 03:06 PM

welcome to Yii family.

app ya extensions use kr skty ho

http://www.yiiframew...account-module/
http://www.yiiframew...nsion/yii-user/
http://www.yiiframew...ser-management/
http://www.yiiframew...xtension/login/
Cheers
Perochak
Web Design - Logo Design - Application Development

My Blog | Forums Comparison
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users