render()传递参数的问题

我的controller是这样设计的

              $model=new Purchorders;


            $locations=new Locations;


            $suppliers=new Suppliers;                


            $locationscount=$locations->count();


            $supplierscount=$suppliers->count();


            $this->render('create',array(


                    'model'=>$model,


                    'locations'=>$locations,


                    'suppliers'=>$suppliers,


                    'supplierscount'=>$supplierscount,


                    'locationscount'=>$locationscount,


                    


            ));

在view中想使用$locationscount这个变量,代码如下,无法获取想要的值,结果一片空白

<?php echo $locationscount; ?>

问题已解决:原因是我的view是creat下的子页,需要再次传参数

<?php echo $this->renderPartial(’_form’, array(‘model’=>$model,

                                           'locations'=&gt;&#036;locations,


                                            'suppliers'=&gt;&#036;suppliers,


                                            'supplierscount'=&gt;&#036;supplierscount,


                                            'locationscount'=&gt;&#036;locationscount,)); ?&gt;

这样就好了

问题已解决:原因是我的view是creat下的子页,需要再次传参数

<?php echo $this->renderPartial(’_form’, array(‘model’=>$model,

                                           'locations'=&gt;&#036;locations,


                                            'suppliers'=&gt;&#036;suppliers,


                                            'supplierscount'=&gt;&#036;supplierscount,


                                            'locationscount'=&gt;&#036;locationscount,)); ?&gt;

这样就好了