我希望页脚内容是动态的,即我希望从数据库中显示一些数据,但是,页脚不能被任何控制器调用,它只是包含在布局部分中。我如何使用数据库连接在页脚中获取动态数据
<header>
<div class="container">
<?php include('header.phtml');?>
<div class="clearfix"></div>
<nav class="navbar navbar-default">
<?php include('menu.phtml');?>
</nav>
<div class="clearfix"></div>
<div class="slider-home">
<?php include('slider.phtml');?>
</div>
<div class="clearfix"></div>
</div>
</header>
<!--Header End-->
<!--Container Start-->
<div class="container orange-panelbg">
<?php echo $this->content; ?>
</div>
<!--Container End-->
<!--Footer Start-->
<footer>
<div class="container">
<?php include('footer-widget.phtml'); ?>
</div>
<div class="clearfix"> </div>
<div class="copyright">
<div class="container">
<?php include('footer.phtml'); ?>
</div>
</div>
</footer>
在这里,我使用控制器和他们的操作调用的所有内容都将反映$this内容的更改,所以如果我更改了方法,那么页脚内容也将更改。我如何实现这一点,或者更确切地说,我使用核心php-mysql-db连接??
下面是一篇可以用来解决此问题的文章:http://www.michaelgallego.fr/blog/2012/10/06/how-to-replace-the-action-helper-in-zf-2-and-make-great-widgetized-content/
如果这有帮助,如果有人提出任何进一步的问题,请告诉我。