magento --------开发方面---controller和其他的一些数据的取得和操作


controller中的
1
得到layout
在controller中
$this->getLayout()->getBlock('head')
就是:
Mage::getSingleton('core/layout')->getBlock('head')

2
在controller中:
$this->_addContent($this->getLayout()->createBlock('blog/manage_blog_edit'))
就是
$this->getLayout()->getBlock('content')->append($this->getLayout()->createBlock('blog/manage_blog_edit'));



$this->_addContent($this->getLayout()->createBlock('blog/manage_blog_edit'))
       ->_addLeft($this->getLayout()->createBlock('blog/manage_blog_edit_tabs'));

3
//开始画方法
$this->loadLayout();
//画出来。
$this->renderLayout();
重定向。
$this->_redirect('*/*/');

4
得到登陆了的账户的信息。
Mage::getSingleton('admin/session')->getUser()->getFirstname()
Mage::getSingleton('admin/session')->getUser()->getLastname()

5
得到当前的category----Mage_Catalog_Model_Category
Mage::getSingleton('catalog/layer')->getCurrentCategory()

你可能感兴趣的:(controller)