简体   繁体   English

如何在magento 1.7中打开开发人员模式?

[英]How to turn on developer mode in magento 1.7?

I go through this tutorial and my problem consists in the fact that I do not get any function.include error on "The Global Config and Creating The Model" section (when assigning to a variable Mage::getModel('weblog/blogpost') , while the model doesn't exists yet ). 我通过教程,我的问题在于我没有在“全局配置和创建模型”部分中获得任何function.include错误(当分配给变量Mage::getModel('weblog/blogpost') ,虽然该模型尚不存在 )。

At some point I found in /index.php an if statement in which is called the following method: Mage::setIsDeveloperMode(true); 在某些时候,我在/index.php中找到了一个if语句,其中调用了以下方法: Mage::setIsDeveloperMode(true); To test it, I put it outside the if statement (which I know is not good practice). 为了测试它,我把它放在if语句之外(我知道这不是一个好习惯)。

The result was that I got this warning message: 结果是我收到了这条警告信息:

Warning: simplexml_load_string() [function.simplexml-load-string]: Entity: line 1: parser error : XML declaration allowed only at the start of the document  in /home/dowebro/public_html/magento/lib/Varien/Simplexml/Config.php on line 510

#0 [internal function]: mageCoreErrorHandler(2, 'simplexml_load_...', '/home/dowebro/p...', 510, Array)
#1 /home/dowebro/public_html/magento/lib/Varien/Simplexml/Config.php(510): simplexml_load_string('    loadString('    loadFile('/home/dowebro/p...')
#4 /home/dowebro/public_html/magento/app/code/core/Mage/Core/Model/Config.php(318): Mage_Core_Model_Config->loadModulesConfiguration(Array, Object(Mage_Core_Model_Config))
#5 /home/dowebro/public_html/magento/app/code/core/Mage/Core/Model/App.php(414): Mage_Core_Model_Config->loadModules()
#6 /home/dowebro/public_html/magento/app/code/core/Mage/Core/Model/App.php(343): Mage_Core_Model_App->_initModules()
#7 /home/dowebro/public_html/magento/app/Mage.php(683): Mage_Core_Model_App->run(Array)
#8 /home/dowebro/public_html/magento/index.php(91): Mage::run('', 'store')
#9 {main}

but still no error which I would expect. 但仍然没有我期望的错误。

So, how can I get rid of this Warning message, but more important, how can I see errors in developement mode? 那么,我怎样才能摆脱这条警告信息,但更重要的是,如何在开发模式中看到错误?

Thank you! 谢谢!

EDIT: While I go on with this tutorial, I see that I don't get any kind of feedback from core classes. 编辑:当我继续本教程时,我发现我没有得到核心类的任何反馈。 Ex: I should get "Can't retrieve entity config: weblog/blogpost" while trying yo get data from a model of which resource definition is incomplete. 例如:在尝试从资源定义不完整的模型中获取数据时,我应该得到“无法检索实体配置:weblog / blogpost”。 Well, I don't. 好吧,我没有。 :| :|

Developer mode is a sort of use strict for PHP and Magento. 开发人员模式是对PHP和Magento的一种use strict It forces you to fix everything . 它会迫使你解决所有问题 If looks like the simplexml_load_string function doesn't like one of the XML configuration files in your system. 如果看起来像simplexml_load_string函数不喜欢系统中的一个XML配置文件。 You can find out which one by going to line 510 in 您可以通过前往510行找到哪一个

/home/dowebro/public_html/magento/lib/Varien/Simplexml/Config.php

and var dumping the variable that's being passed to loadFile . 和var转储传递给loadFile的变量。

Based on the error message 基于错误消息

XML declaration allowed only at the start of the document

My guess is your config.xml XML prolog has some whitespace before it 我的猜测是你的config.xml XML prolog之前有一些空格

[    ]<?xml version=...

or you've accidentally added a <? 或者你不小心添加了<? somewhere in your XML file. 在XML文件中的某个位置。

I don't know why my post got deleted. 我不知道为什么我的帖子被删除了。 Mods I can't even message you back. Mods我甚至不能给你留言。

I followed the same tutorial as @Michael did and encountered the same problem. 我跟着@Michael做了同样的教程,遇到了同样的问题。

The solution is going to root of application index.php and remove hash from the front of below statement 解决方案将转到应用程序index.php的根目录,并从下面的语句前面删除哈希

#ini_set('display_errors', 1)

to

ini_set('display_errors', 1)

I have this problem and i can solve debugging the file app\\code\\core\\Mage\\Core\\Model\\Config.php 我有这个问题,我可以解决调试文件app \\ code \\ core \\ Mage \\ Core \\ Model \\ Config.php

In this class search the metod loadModulesConfiguration and im sure that you have the following code: 在这个类中搜索metod loadModulesConfiguration并确保你有以下代码:

foreach ($fileName as $configFile) {
    $configFile = $this->getModuleDir('etc', $modName).DS.$configFile;
    if ($mergeModel->loadFile($configFile)) {
         $mergeToObject->extend($mergeModel, true);
    }
}

And this add a block try catch like this : 并添加一个块try try如下:

foreach ($fileName as $configFile) {
    try {
        $configFile = $this->getModuleDir('etc', $modName).DS.$configFile;
        if ($mergeModel->loadFile($configFile)) {
            $mergeToObject->extend($mergeModel, true);
        }
    } catch(Exception $e) {
        Mage::log($configFile);
    }
 }

And then check the log and you will have the name of the file that is the problem 然后检查日志,您将获得问题文件的名称

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM