Magento And Drupal : Small Tips

来源:互联网 发布:软件行业增值税税负 编辑:程序博客网 时间:2024/04/29 13:14
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);
}


原创粉丝点击