Topic: punBB Evolution
I got bored, so today I decided to reprogram the whole punBB from scratch.
Basically, it is a whole new code with the same database structure like punBB
This is what I have gotten so far. (After I finish the core functionality, I will
post the whole source code)
Architecture - Theme
Each page consists of collection of widget.
Theme is a collection of pages
Simplify the code for each page by breaking down logic into many small pieces of widget.
Each widget loads it own data and has its own interface. Its interface can be overrided by
theme manager.
For example:
Code for main page
index.php
// Load widgets
$template->load('main', array(
new Widget('Header', array(
"title" => "punBB Evolution",
"meta_desc" => "This is meta description",
"meta_keyword" => "This is keyword"
)),
new Widget('ForumMenu', array("selected" => "Index")),
new Widget('ForumList')
));
// Process the template and all widget inside the
// templates
$template->show();
templates/default/main.php
<!doctype html>
<html>
<head>
<link rel='stylesheet' href='<?php echo $template_base ?>/styles.css'>
<?php $this->widget("Header"); ?>
</head>
<body>
<div id='punbb-wrap'>
<?php $this->widget("ForumMenu"); ?>
<?php $this->widget("ForumList"); ?>
</div>
</body>
</html>
As you can see, template (templates/default/main.php) is the one who specify the position of each widget,
while page (index.php) specify which widgets are needed.
(Continue to next post)