Skip to content

Commit

Permalink
Fixing the Archives controller
Browse files Browse the repository at this point in the history
  • Loading branch information
tracend committed Apr 15, 2012
1 parent 907b6cd commit 59f9864
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
11 changes: 8 additions & 3 deletions app/controllers/archives.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,14 @@ class Archives extends Controller {
public $date;

//This function maps the controller name and function name to the file location of the .php file to include
function index( $path ) {
function index( $params ) {

$this->data['date'] = implode("-", $path);
// data is being passed as a key-value pair
foreach( $params as $k => $v ){
$this->data['date'] = $k ."-". $v;
// only loop throught he first item
break;
}

// load the index
$this->render();
Expand All @@ -30,7 +35,7 @@ function requestAllPages() {

$page=new Page();
$page->tablename = "pages";
$pages = $page->retrieve_many("date LIKE '%".$this->date."%'");
$pages = $page->retrieve_many("date LIKE '%".$this->data['date']."%'");
$view = getPath('views/archives/body.php');

foreach( $pages as $data ){
Expand Down
2 changes: 2 additions & 0 deletions app/helpers/mvc.php
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,8 @@ function beautify_array( $params ){
foreach( $params as $num => $param ){
if( $num%2 == 0 ){
$key = $param;
// stop if there is no more params
if( empty( $params[$num+1] ) ) continue;
$value = $params[$num+1];
// save the new key/value pair
$newparams[ $key ] = $value;
Expand Down
Binary file modified data/pages.sqlite
Binary file not shown.

0 comments on commit 59f9864

Please sign in to comment.