简体   繁体   English

Magento-分页符

[英]Magento - half page breaking

i am stuck with an issue on magento store. 我在magento商店上遇到了问题。 half of page display and then it breaks. 页面显示一半,然后中断。 here is my page. 这是我的页面。

http://www.statecertification.com/regshop/class-locator.html http://www.statecertification.com/regshop/class-locator.html

if you look page source, this is code where it breaks 如果您查看页面源代码,则这是断点代码

<script type="text/javascript">

        var marker, i;
        var map;
        var store_locations = <?php echo json_encode($Stores); ?>;

can any one look into , same page is working on other servers. 任何人都可以查看,同一页面正在其他服务器上工作。

Thanks 谢谢

Enable Developer Mode and set your index.php to display errors. 启用开发人员模式并设置index.php以显示错误。

Around lines 75-79: 在第75-79行周围:

#if (isset($_SERVER['MAGE_IS_DEVELOPER_MODE'])) {
    Mage::setIsDeveloperMode(true);
#}

ini_set('display_errors', 1);

This will enable it - make sure you restore it when you are done though. 这将启用它-确保完成后将其还原。

Also check in /var/log plus your Apache logs folder to find out exactly why it's breaking. 另外,请检入/var/log以及您的Apache日志文件夹,以查明中断的确切原因。

用单引号引起来:

var store_locations = '<?php echo json_encode($Stores); ?>';

您不需要回显:

 var store_locations = <?= json_encode($Stores); ?>;

What version of magnento and php are you using because it definitely a php error? 您使用的是哪个版本的magnento和php,因为它肯定是php错误? json_encode require php >= 5.2.0 json_encode需要php> = 5.2.0

Also try 也试试

var store_locations = '<?php echo Mage::helper('core')->jsonEncode($Stores);?>';

No quote needed as it's JSON .. 不需要引号,因为它是JSON ..

var test = {'var1':1, 'var2':2};
//this is totally OK and must not be enclosed bu quotes (a JSON object is not a string!)

By the way it's not a javascript issue, but a PHP hidden Fatal error. 顺便说一句,这不是JavaScript问题,而是PHP隐藏的致命错误。 (the HTML is truncated, with or without quotes..) (HTML被截断,带或不带引号。)

To see what happened, you need to activate error display : 要查看发生了什么,您需要激活错误显示:

<?php
ini_set('display_errors' 1);
error_reporting(E_ALL);
?>

Looking at your source, there can be 2 problems : 查看您的来源,可能有2个问题:

  • json_encode function is missing (what is your PHP version ?) 缺少json_encode函数(您的PHP版本是什么?)
  • $Stores variable is undefined or not a STRING $ Stores变量未定义或不是STRING

Have fun 玩得开心

According to my opinion, the problem is not in the quotes and etc. 根据我的意见,问题不在引号等中。

I bet, that the variable $Stores, doesn't exist. 我敢打赌,变量$ Stores不存在。

The author also can do the following actions to discover the problem: 作者还可以执行以下操作来发现问题:

In index.php use ini_set('display_errors', '1'); 在index.php中,使用ini_set('display_errors','1'); instead of #ini_set('display_errors', '1'); 而不是#ini_set('display_errors','1'); This will show you, what is the exact error. 这将向您显示确切的错误是什么。

I had the exact situation today. 我今天有确切的情况。 Homepage loaded till half and then breaks, no footer, etc. I already had ioncube loader installed and that was not the issue. 主页加载到一半,然后破裂,没有页脚等。我已经安装了ioncube loader,这不是问题。 In my case it turned out to be a file midcolumn.phtml from my theme folder /app/design/frontend/yourthemehere/default/template/page/html/midcolumn.phtml because I edited this file yesterday and when I restored the original file the homepage worked again just fine. 在我的情况下,它原来是主题文件夹/app/design/frontend/yourthemehere/default/template/page/html/midcolumn.phtml中的文件midcolumn.phtml,因为我昨天编辑了该文件,并在还原原始文件时主页再次正常运行。 This my not be your case though. 不过这不是你的情况。 I suggest turning magento debug by uncommenting line in your index.php file 我建议通过取消注释index.php文件中的行来启用magento调试

ini_set('display_errors', 1); ini_set('display_errors',1);

*(remove # and put it back when your done) *(删除#并在完成后放回去)

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

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