如何在2个不同的布局文件中包含相同的导航栏?我不希望在2个布局文件中重复导航条形码。
以下是我的导航条形码:
<?php
echo $this->Html->css('nav_bar.css');
?>
<script language="javascript" type="text/javascript">
sfHover = function() {
var sfEls = document.getElementById("navbar").getElementsByTagName("li");
for (var i=0; i<sfEls.length; i++) {
sfEls[i].onmouseover=function() {
this.className+=" hover";
}
sfEls[i].onmouseout=function() {
this.className=this.className.replace(new RegExp(" hover\\b"), "");
}
}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);
</script>
<div id="menu">
<ul id="nav">
<li><?php echo $this->Html->link('Home', '/pages/home', array()); ?></li>
<li><?php echo $this->Html->link('Our Program', '#', array()); ?><ul>
<li><?php echo $this->Html->link('Preschool', '/pages/preschool',
array()); ?></li>
<li><?php echo $this->Html->link('Kindergarten', '/pages/kindergarten', array()); ?></li>
<li><?php echo $this->Html->link('Summer Camp', '/pages/summer_camp', array()); ?></li>
</ul>
</li>
<li><?php echo $this->Html->link('About Us','#', array()); ?><ul>
<li><?php echo $this->Html->link('Merry Flowers', '/pages/about_us', array()); ?></li>
<li><?php echo $this->Html->link('Tour Our School','/pages/tour_our_school', array()); ?></li>
<li><?php echo $this->Html->link('Contact Us', '/pages/contact_us', array()); ?></li>
</ul>
</li>
<li><?php echo $this->Html->link('Events','#', array()); ?><ul>
<li><?php echo $this->Html->link('News & Events', '#', array()); ?>
<ul>
<li><?php echo $this->Html->link('Sports Day','/pages/sports_day',array()); ?></li>
</ul>
</li>
<li><?php echo $this->Html->link('List of Holidays', '/pages/list_of_holidays', array()); ?></li>
</ul>
</li>
<li><a href="#">FAQ</a><ul>
<li><?php echo $this->Html->link('FAQ', '/pages/faq', array()); ?></li>
<li><?php echo $this->Html->link('Feedback', '/feedbacks/add', array()); ?></li>
<li><?php echo $this->Html->link('Discussion', '/pages/discussion', array()); ?></li>
</ul>
</li>
<li><a href="#">Admissions</a><ul>
<li><?php echo $this->Html->link('Enroll Now','/students/add', array()); ?></li>
</ul>
</li>
</ul><!--finish ul nav-->
</div> <!--finish div menu-->
谢谢。