Magento And Drupal : Small Tips

本文介绍了一种通过创建自定义日志文件来高效存储和跟踪调试信息的方法,该方法使用PHP函数实现,简化了从大量日志中提取所需信息的过程。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Sometime, it is easy to use Magento log to track the problem.However, it is hard to find the your desired information as the logfile is large with lots of other information. The better way is tocreate a custom file to store your own debug info. It is easy asfollowing:

  public static function logException(Exception$e)
    {
       if (!self::getConfig()) {
           return;
       }
       $file = self::getStoreConfig('dev/log/exception_file');
       self::log("\n" . $e->__toString(), Zend_Log::ERR,$file);
    }


There are two methods in the phptemplate.engine.They arephptemplate_init and phptemplate_theme. phptemplate_init()implements hook_init() with argument $template.

The main task of phptemplate_init is to incude the template.phpfime so that functions defined in the template.php can be used atproper time and place.Everyone like will have one doubt about theparameter $template. Where does it come from and what is its datastructure?When the drupal boots, it initialize drupal theme usingdrupal_theme_initialize(). In method drupal_theme_initialize()method, it will list all of themes in the drupal and call themeengine init fuction with theme files parameter.

The following code snippets as proof:

if(function_exists($theme_engine.'_init')){
call_user_func($theme_engine.'_init',$theme);
}


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值