通过Krumo调试Magento,提高PHP5程序开发效率
来源:互联网 发布:超次元矩阵手游官网 编辑:程序博客网 时间:2024/05/17 00:09
KRUMO下载地址:http://krumo.sourceforge.net/
Google search gave me some useful results trying to solve my problems. I found Krumo at http://krumo.sourceforge.net/. It’s a PHP debugging tool, replacement for print_r() and var_dump(). After setting up Krumo and running it on Magento it gave me exactly what I wanted. It gave me the object type of the dumped file; in this case it gave me object type of $this.
If your using an IDE studio with code completion support like NuSphere PhpED, ZendStudio or NetBeans and you decide to do something like $this-> you won’t get any methods listed. I haven’t yet seen the IDE that can perform this kind of smart logic and figure out the context of $this by it self.
What you can do is use the information obtained by krumo::dump($this).
In order to use the Krumo at first place, we need to set it up to be used with Magento. After you download the Krumo, unarchive and copy it to some folder inside Magento root folder. I created /developer folder and copied all Krumo files to it.
Next you open the krumo.ini file and set the full path to Krumo folder (see the following image).
After setting up krumo.ini all you need to do is to include class.krumo.php into any file you wish to use it (see the following image).
Performing krumo::dump($this) on /app/design/frontend/default/default/template/catalog/product/view.phtml file will return object type, Mage_Catalog_Block_Product_View.
Now if you do
Mage_Catalog_Block_Product_View::
your’re IDE supporting code completion will give you a drop down of all the available methods (see the following image), let’s say canEmailToFriend();
Mage_Catalog_Block_Product_View::canEmailToFriend();
Now all you need to do is to replace Mage_Catalog_Block_Product_View with $this like
$this->canEmailToFriend();
And your done.
All of this may look like “why do I need this“. What you need it a smart IDE, one that can figure out the context of $this by it self and call the methods accordingly. No IDE currently does that, if I’m not missing on something.
Krumo debugger tool has few other neat tricks in its sleeves. It can retrieve a list of all the available classes, constants and so on (see the following image).
For now I see no better solution to retrieve the object context of $this across all those Magento files. Hope this was helpful for you.
- 通过Krumo调试Magento,提高PHP5程序开发效率
- 提高程序项目开发效率
- 通过配置ant提高EJB开发效率
- 循环体内调试程序 ---(提高调试效率)
- 调试程序心得-2(提高程序执行效率)
- 安装Node.js以及配置supervisor提高程序调试效率
- iOS开发 -- 使用facebook的chisel来提高调试效率
- 提高C++程序效率
- 提高程序的效率
- 提高C++程序效率
- 如何提高程序效率
- 如何提高程序效率
- 怎样提高程序效率
- 如何提高程序效率
- 如何提高程序效率
- [ASP开发]如何提高WEB程序的效率
- 提高程序执行效率,Web开发技巧30条
- 【分享】android开发该如何提高Android程序的效率
- 用Style Report做的“近两年月销售分析图”
- WM注册表资料搜集
- 《产品经理手册》读书笔记--第一章《产品经理的战略规划框架》1.2
- 去掉 Visual Studio 安装项目 .Net Framework 依赖的方法
- 各数据库ISNULL的处理
- 通过Krumo调试Magento,提高PHP5程序开发效率
- 单独一个产品销售的Magento站点
- 选取记录集的前面N条记录
- Zend 框架的在线文档
- Steve Jobs Speaks at Stanford Commencement
- Windows消息机制要点
- 我们已经开发好了Magento的Ctopay(收汇宝)非3D网关
- SQL四条最基本的数据操作语句:Insert,Select,Update和Delete
- C#启动条