I am in the process of writing a blog and want to try and simplify the coding as much as possible.
I want to create a simple template that I can use to create each and every page / story. On the blog home page I want to call up these pages, only showing the last 5 stories.
All I need to know for now, is it possible to have each of these files load from a MySQL database as an include?
EG. Static code would look as follows:
<div class="container single-page">
<?php
include 'story1.php';
include 'story2.php';
include 'story3.php';
include 'story4.php';
include 'story5.php';
?>
</div>
Is it possible to have something like this:
<div class="container single-page">
<?php
include echo $results
?>
</div>
The reason I want to do this is because I want to do a select from my database to load certain stories, that my be determined by date / theme or any other criteria, and to achieve this one would just have to update the query.
Thanks in advance
Comments
Post a Comment