更多动态页面与sitecake?

时间:2011-07-08 11:04:26

标签: php zend-framework

我刚刚开始使用我真正喜欢的SiteCake!然而,它的使用并不是很动态 - 据我所知 - 不可能有一个主index.php文件,它包含页眉和页脚,然后包含所需的主要内容。

我一直在尝试一些事情,我有个别文件而不是index.php。这样我就将页眉和页脚包含在文件中,但这似乎也不起作用。

我不确定SiteCake如何在页面上呈现内容。我尝试了以下内容:

<?php
include "sitecake/server/sitecake_entry.php";
ob_start();
/*file_get_contents("content/header.php");
file_get_contents("content/footer.php");*/
include "content/header.php";?>
<div class="sc-content-top"><h1>Velkommen til designature</h1></div>
<div class="clearfix"></div>
<div id="content">
<div class="content480 sc-content-left">
    <h2>Hvad kan vi?</h2>
</div>
<div class="content240 sc-content-middle">
    <h2>Hvad kan vi?</h2>
</div>
<div class="content240 sc-content-right">
    <h2>Hvad kan vi?</h2>
</div>
</div>
<?php 
include "content/footer.php";
ob_flush();
?>

上面的代码给了我这个错误:

An error occurred

Application error

Exception information:

Message: Undefined offset: 0

Stack trace:

#0 /home/smith/designature.dk/beta/sitecake/server/application/services/impl/basic/PageTemplateImpl.php(141): Bootstrap::globalErrorHandler(8, 'Undefined offse...', '/home/smith/des...', 141, Array)
#1 /home/smith/designature.dk/beta/sitecake/server/application/services/impl/basic/PageTemplateImpl.php(117): PageTemplateImpl->createTemplate()
#2 /home/smith/designature.dk/beta/sitecake/server/application/services/impl/basic/PageTemplateImpl.php(34): PageTemplateImpl->initTemplateEngine()
#3 /home/smith/designature.dk/beta/sitecake/server/application/services/impl/basic/RenderServiceImpl.php(54): PageTemplateImpl->setPageRequest('/beta/index.php')
#4 /home/smith/designature.dk/beta/sitecake/server/application/services/impl/basic/RenderServiceImpl.php(23): RenderServiceImpl->renderResponse()
#5 /home/smith/designature.dk/beta/sitecake/server/application/controllers/RenderController.php(13): RenderServiceImpl->render('/beta/index.php', false)
#6 /home/smith/designature.dk/beta/sitecake/server/library/Zend/Controller/Action.php(513): RenderController->renderAction()
#7 /home/smith/designature.dk/beta/sitecake/server/library/Zend/Controller/Dispatcher/Standard.php(295): Zend_Controller_Action->dispatch('renderAction')
#8 /home/smith/designature.dk/beta/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/smith/designature.dk/beta/sitecake/server/library/Zend/Application/Bootstrap/Bootstrap.php(97): Zend_Controller_Front->dispatch()
#10 /home/smith/designature.dk/beta/sitecake/server/library/Zend/Application.php(366): Zend_Application_Bootstrap_Bootstrap->run()
#11 /home/smith/designature.dk/beta/sitecake/server/sitecake_entry.php(45): Zend_Application->run()
#12 /home/smith/designature.dk/beta/index.php(2): include('/home/smith/des...')
#13 {main}  
Request Parameters:

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

我不知道错误意味着什么或如何解决它。

正如我写的那样,我也尝试过将index.php文件放在staionary的其他方面,然后包含内容。这允许我编辑页面,看起来它有效,但是当我点击“发布”时,它没有正确保存内容。

有人对我如何使其发挥作用有任何建议吗?

由于

2 个答案:

答案 0 :(得分:0)

在SiteCake的文档中是解决方案,如何在模板中使用php代码: http://sitecake.com/using-php-in-templates.php

答案 1 :(得分:-1)

在请求后,SiteCake页面上的答案就出现了 - 没想到官方解决方案尚未公布。这里适用于其他所有人:http://support.sitecake.com/entries/20258721-more-dynamic