[eluser]awpti[/eluser]
Howdy.
I have the same type of system.. Here's how it works for me:
/controlers/blog.php
Code:
class Blog extends Controller {
private $awTitle = 'awpti.org - Home of geeking, PHP and SQL!';
private $awHeader = 'awpti.org';
private $awNewsLimit = 3;
function Blog() {
parent::Controller();
}
function index() {
$data['Title'] = $this->awTitle;
$data['Header'] = $this->awHeader;
$query_news = 'SELECT * FROM awNews ORDER BY NewsID DESC LIMIT '.$this->awNewsLimit;
$data['Query_News'] = $this->db->query($query_news);
$this->load->view('blog/front', $data);
}
function about() {
$data['Title'] = $this->awTitle.' (About)';
$data['Header'] = $this->awHeader;
$this->load->view('blog/about', $data);
}
} //end class. Duh.
And.. /views/blog/front.php
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title><?= $Title; ?></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Content-Language" content="en-us" />
<meta http-equiv="imagetoolbar" content="no" />
<meta name="MSSmartTagsPreventParsing" content="true" />
<meta name="keywords" content="awpti, php, sql, geeking" />
<meta name="author" content="Geoff Winans (http://www.awpti.org/)" />
<style type="text/css" media="all">@import "/media/style/style.css";</style>
<link rel="alternate" type="application/rss+xml" title="RSS 2.0" href="rss/" />
</head>
<body>
<div class="content">
<div class="toph"></div>
<div style="display: none;"><?= $Header; ?></div>
<div class="right">
<div class="title">AWPTI.ORG</div>
<div class="nav">
<ul>
<li><a href="/">HOME</a></li>
<li><a href="/about/">ABOUT</a></li>
<li><a href="http://gallery.awpti.org/">GALLERY</a></li>
</ul>
</div>
<h2>Top Links:</h2>
<ul>
<li><a href="http://www.galerion.org">galerion.org</a></li>
<li><a href="http://www.solucija.com">Solucija</a></li>
<li><a href="http://www.newzbin.com">NewzBin</a></li>
<li><a href="http://www.google.com/reader/">gReader</a></li>
<li><a href="http://www.google.com/mail/">gMail</a></li>
</ul>
<hr />
<!--
<h2>Search</h2>
<form action="#">
<input type="text" value="" class="text" />
<input type="submit" value="Go" class="searchbutton" />
</form>
-->
<br /><br />
<hr />
<div class="footer_text">
© Copyright awpti.org<br />
Design by: <a href="http://www.free-css-templates.com/" title="Free CSS Templates">David Herreman</a><br />
<!-- <a href="rss/">RSS Feed</a> | --><a href="http://jigsaw.w3.org/css-validator/check/referer">CSS</a> and <a href="http://validator.w3.org/check?uri=referer">XHTML</a> <!-- | <a href="#">Login</a> -->
</div>
</div>
<div class="center">
<?php
foreach($Query_News->result() as $news) {
echo '<h2>',$news->PostTitle,"</h2>\n";
echo $news->Content."\n";
echo '<p class="date">Posted by ',$news->PostBy,' <img src="/media/images/comment.gif" alt="comments" /> <a href="#">Comments (##)</a> <img src="/media/images/timeicon.gif" alt="" /> ',unix_to_human(mysql_to_unix($news->PostTime))."</p><br />\n";
}
?>
<!--
<div class="boxad">
Box for ads or whatever. //Unused.
</div>
-->
</div>
<div class="footer"> </div>
</div>
</body>
</html>
Hope this blob of code helps. If you're looking for a "WHY" explanation, check out the 20 minute long blog video tutorial. It's explained fairly well.