diff --git a/app/controllers/archives.php b/app/controllers/archives.php index 8d6ea85..07fe889 100644 --- a/app/controllers/archives.php +++ b/app/controllers/archives.php @@ -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(); @@ -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 ){ diff --git a/app/helpers/mvc.php b/app/helpers/mvc.php index 9f6a519..af1e05b 100644 --- a/app/helpers/mvc.php +++ b/app/helpers/mvc.php @@ -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; diff --git a/data/pages.sqlite b/data/pages.sqlite index 31d6393..62109d9 100644 Binary files a/data/pages.sqlite and b/data/pages.sqlite differ