发生错误 - 未定义的偏移量:0:当我尝试安装SiteCake时

时间:2014-04-10 13:45:56

标签: php html zend-framework

我正在尝试将SiteCake安装到我的基本网站,结构如下: HTML:

<!DOCTYPE html>
<html lang="en">
<head>
   <meta charset="utf-8">
   <meta content="width=device-width, initial-scale=1.0, user-scalable=0" name="viewport">

   <title>Index | Website Name</title>
   <meta content="" name="description">
   <link href="assets/elements/favicon.ico" rel="shortcut icon">
   <link href="assets/css/reset.css" rel="stylesheet" type="text/css">
   <link href="assets/css/core.css" rel="stylesheet" type="text/css">
   <link href="assets/css/tablet-and-mobile.css" media="screen and (max-width: 1024px)" rel="stylesheet">
   <link href="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/themes/smoothness/jquery-ui.css" rel="stylesheet"><!--Libraries & Scripts-->

   <script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js"></script>
   <script src="assets/js/main.js" type="text/javascript"></script><!--IE Support-->
   <!--[if IE]><script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script><![endif]-->
</head>

<body id="index">

   <header id="header"><!--Header-->
      <div id="headerContent">
         <div id="headerLogo">
            <!--Logo--><a href=""><img alt="Website Name Logo" src="assets/elements/logo.png"></a>
         </div>
         <nav><!--Main Menu-->
            <ul id="mainMenu">
               <li><a class="active" href="index.php">Home</a></li>
               <li><a href="contact.php">Contact</a></li>
            </ul>
         </nav>
      </div>
   </header>

   <div id="page"><!--Page Container-->

      <div class="topSection">
         <div class="content">
            <h1>Page Title</h1>
         </div>
      </div>

      <!--Footer-->
      <footer id="footer">
         <div class="content">
            <div class="copyright">
               <p>©2014 Website Name. All rights reserved.</p>
            </div>
         </div>
      </footer>
   </div><!--/Page-->
   <!--Scripts-->
   <script src="assets/js/form-validation.js" type="text/javascript"></script>
   <script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/jquery-ui.min.js"></script>
</body>
</html>

我按照SiteCake上提供的说明,将<?php include "sitecake/server/sitecake_entry.php"; ?>添加到页面的最顶部...一旦我这样做,就会显示此错误:

An error occurred

Application error

Exception information:

Message: Undefined offset: 0

Stack trace:

#0 /home/clients/public_html/sitecake/server/application/services/impl/basic/PageTemplateImpl.php(142): Bootstrap::globalErrorHandler(8, 'Undefined offse...', '/home/clients/p...', 142, Array)
#1 /home/clients/public_html/sitecake/server/application/services/impl/basic/PageTemplateImpl.php(117): PageTemplateImpl->createTemplate()
#2 /home/clients/public_html/sitecake/server/application/services/impl/basic/PageTemplateImpl.php(34): PageTemplateImpl->initTemplateEngine()
#3 /home/clients/public_html/sitecake/server/application/services/impl/basic/RenderServiceImpl.php(54): PageTemplateImpl->setPageRequest('/index.php')
#4 /home/clients/public_html/sitecake/server/application/services/impl/basic/RenderServiceImpl.php(23): RenderServiceImpl->renderResponse()
#5 /home/clients/public_html/sitecake/server/application/controllers/RenderController.php(13): RenderServiceImpl->render('/index.php', false)
#6 /home/clients/public_html/sitecake/server/library/Zend/Controller/Action.php(513): RenderController->renderAction()
#7 /home/clients/public_html/sitecake/server/library/Zend/Controller/Dispatcher/Standard.php(295): Zend_Controller_Action->dispatch('renderAction')
#8 /home/clients/public_html/sitecake/server/library/Zend/Controller/Front.php(954): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http))
#9 /home/clients/public_html/sitecake/server/library/Zend/Application/Bootstrap/Bootstrap.php(97): Zend_Controller_Front->dispatch()
#10 /home/clients/public_html/sitecake/server/library/Zend/Application.php(366): Zend_Application_Bootstrap_Bootstrap->run()
#11 /home/clients/public_html/sitecake/server/sitecake_entry.php(47): Zend_Application->run()
#12 /home/clients/public_html/index.php(1): include('/home/clients/p...')
#13 {main}  
Request Parameters:

array (
  'controller' => 'render',
  'action' => 'render',
)  

可在此处观看:http://loai.directory

以下内容显示在error.log中:

[10-Apr-2014 11:29:02 UTC] PHP Fatal error:  Uncaught exception 'Zend_Exception' with message 'Cannot modify header information - headers already sent by (output started at /home/clients/public_html/index.php:2)' in /home/clients/public_html/sitecake/server/application/services/impl/onesite/Bootstrap.php:122
Stack trace:
#0 [internal function]: Bootstrap::globalErrorHandler(2, 'Cannot modify h...', '/home/clients/p...', 3, Array)
#1 /home/clients/public_html/sitecake/server/application/layouts/scripts/layout.phtml(3): header('Expires: Mon, 2...')
#2 /home/clients/public_html/sitecake/server/library/Zend/View.php(108): include('/home/clients/p...')
#3 /home/clients/public_html/sitecake/server/library/Zend/View/Abstract.php(880): Zend_View->_run('/home/clients/p...')
#4 /home/clients/public_html/sitecake/server/library/Zend/Layout.php(796): Zend_View_Abstract->render('layout.phtml')
#5 /home/clients/public_html/sitecake/server/library/Zend/Layout/Controller/Plugin/Layout.php(143): Zend_Layout->render()
#6 /home/clients/public_html/sitecake/server/library/ in /home/clients/public_html/sitecake/server/application/services/impl/onesite/Bootstrap.php on line 122
[10-Apr-2014 11:29:23 UTC] PHP Fatal error:  Uncaught exception 'Zend_Exception' with message 'Cannot modify header information - headers already sent by (output started at /home/clients/public_html/index.php:2)' in /home/clients/public_html/sitecake/server/application/services/impl/onesite/Bootstrap.php:122
Stack trace:
#0 [internal function]: Bootstrap::globalErrorHandler(2, 'Cannot modify h...', '/home/clients/p...', 3, Array)
#1 /home/clients/public_html/sitecake/server/application/layouts/scripts/layout.phtml(3): header('Expires: Mon, 2...')
#2 /home/clients/public_html/sitecake/server/library/Zend/View.php(108): include('/home/clients/p...')
#3 /home/clients/public_html/sitecake/server/library/Zend/View/Abstract.php(880): Zend_View->_run('/home/clients/p...')
#4 /home/clients/public_html/sitecake/server/library/Zend/Layout.php(796): Zend_View_Abstract->render('layout.phtml')
#5 /home/clients/public_html/sitecake/server/library/Zend/Layout/Controller/Plugin/Layout.php(143): Zend_Layout->render()
#6 /home/clients/public_html/sitecake/server/library/ in /home/clients/public_html/sitecake/server/application/services/impl/onesite/Bootstrap.php on line 122
[10-Apr-2014 07:43:04 America/New_York] PHP Fatal error:  Call to undefined function href() in /home/clients/public_html/assets/includes/menu.inc on line 1
[10-Apr-2014 07:43:05 America/New_York] PHP Fatal error:  Call to undefined function href() in /home/clients/public_html/assets/includes/menu.inc on line 1

尝试解决问题,我尝试更改include的位置并将其添加到正文中的某个位置,我还尝试将include更改为include_once,并尝试添加以下代码段到页脚:

<?php
          include “extern_php_code.php”;
          echo render_footer();
      ?>

但没有什么对我有用,我做错了什么?

2 个答案:

答案 0 :(得分:0)

请检查第142行上的以下文件,它是未定义偏移量的错误来源0可能该数组为空而不是索引为0的元素

/home/clients/public_html/sitecake/server/application/services/impl/basic/PageTemplateImpl.php(142)

see herestack overflow quetsion

答案 1 :(得分:0)

看起来您的头标记丢失了。 以这种方式改变第142行,否则检查是否缺少头标记

if(isset($head[0])){
    $head[0]->innertext .= '$$$#sc_header[{{}}]';
}
else {
    // head tag not found
}