在 Zend Framework 中更改 header.html 文件会隐藏文本

问题描述 投票:0回答:1

我正在尝试替换用 Zend Framework 编写的 header.html 和 footer.html 文件。而旧标头位于同一位置的

application/cache/header.html
footer.html
。我用新的 header.html 和 footer.html 替换了这些文件。

css和js文件以及其余代码以以下方式包含在文件中

/application/modules/default/layout/global.phtml

echo $this->headLink()->appendStylesheet($host . $this->basePath() .'/css/mycssfile.css')
                      ->prependFile($host . $this->basePath() . '/js/myjs.js');

页眉和页脚通过以下代码加载:

$headerPath = APPLICATION_PATH . '/cache/header.html';
$headerHtml = file_get_contents($headerPath);

$footerPath = APPLICATION_PATH . '/cache/footer.html';
$footerHtml = file_get_contents($footerPath);

在该页面的后面,按以下方式附加页眉和页脚:

<header id="header_rwd">
<?php echo $headerHtml; ?>
</header>
<footer id="footer_rwd">
<?php echo $footerHtml; ?>

完成这一切后,当我打开主页时,页眉和页脚出现,上面没有任何文本。

我还在 header.html 文件中编写了一些 jQuery。但 footer.html 文件中没有。是因为 jQuery 还是只是 css 抛出的一些错误?

我搜索了很多论坛,但没有得到任何结果。

我是 Zend Framework 的初学者,我想做的就是更改页眉和页脚文件。

任何帮助将不胜感激。

php html css zend-framework
1个回答
0
投票

这不是在布局或任何其他视图中渲染视图的推荐方法。你应该使用:

<?php print $this->render('path/to/file'); ?>

此外,显示页眉和页脚文件内容。

© www.soinside.com 2019 - 2024. All rights reserved.