Quantcast
Channel: Yii Framework Forum
Viewing all articles
Browse latest Browse all 18717

How Create Component

$
0
0
i want create some component, for example
class Geo extends CWidget
{
        public $text;
	
	public function run()
	{
            
            if (Yii::app()->request->isPostRequest)
            {
                $this->text = Yii::app()->request->getPost('text');
            }

            $this->render('geo', array(
                'text'=>$this->text,          
            ));
		
	}
	
}

//view

<input type="text" id="text" name="text" value="<?php echo $text; ?>" />


now i want to put this component inside controller

this is view controller
echo CHtml::beginForm();

$this->widget('Geo');
echo CHtml::submitButton('OK');

echo CHtml::endForm();




so how can i access of new value of property text in controller?

$geo=new Geo;

if (Yii::app()->request->isPostRequest)
    $geo = $_POST['Geo'];// don't work

echo $geo->text;

Viewing all articles
Browse latest Browse all 18717

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>