【发布时间】:2014-07-02 00:27:24
【问题描述】:
我正在提交一个表单并从模型中获取结果。我想在 phtml 文件中显示结果,即提交后的整个集合需要在 phtml 文件中
这是我的代码
控制器
$this->loadLayout();
if($this->getRequest()->isPost())
{
$post = $this->getRequest()->getPost();
$data = array();
$collection = Mage::getModel('searchservice/service')->getCollection();
$collection->addFieldToFilter('compstate',array('eq'=>$post['input1']));
Mage::getSingleton('core/session')->addSuccess(Mage::helper('searchservice')->__('Displaying Your Result'));
$this->renderLayout();
}
我想要从集合过滤器返回的 aaray 中的数据,并在 phtml 中与 foreach 一起使用。
【问题讨论】:
标签: php magento magento-1.8