خوب راستش این کد صفحه اصلی هستش که من تو کد بالا حذفش کردم.
<?php
include('model/database.php');
include('model/post.php');
include('model/post_db.php');
include('model/category.php');
include('model/category_db.php');
include('view/header.php');
if(isset($_POST['action'])) {
$action = $_POST['action'];
} else if(isset($_GET['action'])){
$action = $_GET['action'];
} else {
$action = 'show_posts';
}
if ($action == 'show_posts') {
//Show All posts
$posts = PostDB::getPosts();
include('posts.php');
}
/*
* include footer
*/
// Get the list of categories for show in footer.php
$categories = CategoryDB::getCategories();
include('view/footer.php');
?>
اینجا همونطور که میبینید 17 ت 23 حتما اجرا میشه و تو خط 21 از include استفاده شده و متغییر خط 21 رو بدون مشکل میفرسته.
اینجا خط 32 هم اجرا میشه خوب مطمئنن و محتویات فوتر هم بارگذاری میشه. فقط مشکل اینه که من نمیتونم از categories که فرستادمش به Footer ، استفاده بکنم.
این هم کد Footer
</div><!-- /.blog-main -->
<div class="col-sm-3 col-sm-offset-1 blog-sidebar">
<div class="sidebar-module sidebar-module-inset">
<h4>About</h4>
<p>Etiam porta <em>sem malesuada magna</em> mollis euismod. Cras mattis consectetur purus sit amet fermentum. Aenean lacinia bibendum nulla sed consectetur.</p>
</div>
<div class="sidebar-module">
<h4>Catogeries</h4>
<ol class="list-unstyled">
<?php foreach($catogeries as $category):?>
<li><a href="<?php echo $category->getID();?>"><?php echo $category->getName(); ?></a></li>
<?php endforeach; ?>
</ol>
</div>
</div><!-- /.blog-sidebar -->
</div><!-- /.row -->
</div><!-- /.container -->
<footer class="blog-footer">
<p>PHPLoversBlog ©</p>
<p>
<a href="#">Back to top</a>
</p>
</footer>
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script src="js/bootstrap.js"></script>
</body>
</html>
این هم خطایی که در حال حاضر برای این کد نشون میده
Screenshot from 2015-05-03 17:19:00.png