php - Retrieve Variable form Render Partial Yii -
i in process of trying clean long page cutting sections , using render partial various sections. far has cleaned page , increased readability, have 1 little issue.
i have main index page , have section loops through customers orders , section show there user accounts ie:
$this->renderpartial('engineer_files/engineer_order', array( 'model' => $model, 'orderservices' => $orderservices, 'items' => $items, 'extras' => $extras ) ); $this->renderpartial('engineer_files/rad', array( 'model' => $model, 'orderservices' => $orderservices, 'items' => $items, 'extras' => $extras, 'servicesdp' => $servicesdp, 'packageid' => $packageid ) );
within page engineer_order have next
$packageid = $services->service_id;
however not seem able access variable within rad page. can see have tried passing variable in render partial. if declare variable on index page ie
$this->renderpartial('engineer_files/engineer_order', array( 'model' => $model, 'orderservices' => $orderservices, 'items' => $items, 'extras' => $extras ) ); $packageid = 2; $this->renderpartial('engineer_files/rad', array( 'model' => $model, 'orderservices' => $orderservices, 'items' => $items, 'extras' => $extras, 'servicesdp' => $servicesdp, 'packageid' => $packageid ) );
then variable accessible , usable, ideally know how declare variable in 1 render partial , pass same variable render partial. many thanks
you can't create variable in renderpartial , somehow utilize same variable outside view. have create variable within engineer_order
?
because thing can create variable in index
page before render else , pass variable both renderpartials.
$myvar = 'bla'; $this->renderpartial('engineer_files/engineer_order', array('myvar' => $myvar) ); $this->renderpartial('engineer_files/rad', array('myvar' => $myvar) );
php yii
No comments:
Post a Comment