Yii Framework Forum: Array List And Array Value - Yii Framework Forum

Jump to content

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

Array List And Array Value Rate Topic: -----

#1 User is offline   Ravi P Thanki 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 61
  • Joined: 18-March 13
  • Location:Ahmedabad

Posted 27 June 2013 - 07:34 AM

public $array_boy=array('1'=>'ravi','2'=>'ajay','3'=>'raj');
public function getArrayList($arrayname)
{
return $this->$arrayname;
}

public function getArrayvalue($arrayname, $key)
{

$a = $this->$arrayname;

return $a[$key];
}
<div class="field">
<?php echo $form->labelEx($model,'boy'); ?>
<?php echo $form->dropDownList($model,'boy',boy::model()->getArrayList("array_boy"),array('select' =>'select')); ?>
<?php echo $form->error($model,'boy'); ?>
</div>
array(
'name'=>'boy',
'value'=>$model-> getArrayvalue('array_boy',$model->boy),
),
Ravi Thanki
Yii,Cakephp and Magento Developer,
blog:http://ravithanki.wordpress.com
0

#2 User is offline   Ravi Bhalodiya 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 64
  • Joined: 27-August 12
  • Location:Gujarat India

Posted 19 July 2013 - 05:29 AM

Nice One... But I can not understand the actual use of this model function. This is useful for static array only.. Am i right??
Regards
Ravi Bhalodiya.
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