Refactoring Display logic
This commit is contained in:
parent
1f4d4acf94
commit
012c3f8717
6 changed files with 135 additions and 193 deletions
|
@ -3,25 +3,16 @@
|
|||
/**
|
||||
* PHP Display Class File for PICKLES
|
||||
*
|
||||
* PICKLES is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of
|
||||
* the License, or (at your option) any later version.
|
||||
* PHP version 5
|
||||
*
|
||||
* PICKLES is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
* Licensed under the GNU General Public License Version 3
|
||||
* Redistribution of these files must retain the above copyright notice.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with PICKLES. If not, see
|
||||
* <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* @author Joshua John Sherman <josh@phpwithpickles.org>
|
||||
* @copyright Copyright 2007, 2008 Joshua John Sherman
|
||||
* @package pickles
|
||||
* @author Josh Sherman <josh@phpwithpickles.org>
|
||||
* @copyright Copyright 2007-2010, Gravity Boulevard, LLC
|
||||
* @license http://www.gnu.org/licenses/gpl.html GPL v3
|
||||
* @link http://phpwithpickles.org
|
||||
* @license http://www.gnu.org/copyleft/lesser.html
|
||||
* @package PICKLES
|
||||
*/
|
||||
|
||||
/**
|
||||
|
@ -33,24 +24,15 @@
|
|||
* system than Smarty. The general rules around the caching will
|
||||
* be the same though.
|
||||
*/
|
||||
class Display_PHP extends Display_Common {
|
||||
|
||||
private $template_path = null;
|
||||
private $template = null;
|
||||
private $shared_template = null;
|
||||
|
||||
public function __construct(Config $config, Error $error) {
|
||||
parent::__construct($config, $error);
|
||||
|
||||
// Establishes the template path
|
||||
$this->template_path = SITE_PATH . '../templates/';
|
||||
}
|
||||
|
||||
public function prepare() {
|
||||
|
||||
class Display_PHP extends Display_Common
|
||||
{
|
||||
public function prepare()
|
||||
{
|
||||
// Enables caching
|
||||
if ($this->caching == true) {
|
||||
if (is_numeric($this->caching)) {
|
||||
if ($this->caching == true)
|
||||
{
|
||||
if (is_numeric($this->caching))
|
||||
{
|
||||
//$this->smarty->cache_lifetime = $this->caching;
|
||||
}
|
||||
}
|
||||
|
@ -62,8 +44,8 @@ class Display_PHP extends Display_Common {
|
|||
/**
|
||||
* Renders the PHP templated pages
|
||||
*/
|
||||
public function render() {
|
||||
|
||||
public function render()
|
||||
{
|
||||
//if (filemtime($this->template)) {
|
||||
// readfile('/var/www/josh/pickles/var/joshtronic.localhost/smarty/cache/home.html');
|
||||
//}
|
||||
|
@ -71,8 +53,10 @@ class Display_PHP extends Display_Common {
|
|||
/**
|
||||
* @todo There's a bug with the store home page since it's a redirect, maybe
|
||||
*/
|
||||
if (!file_exists($this->template)) {
|
||||
if (file_exists($this->shared_template)) {
|
||||
if (!file_exists($this->template))
|
||||
{
|
||||
if (file_exists($this->shared_template))
|
||||
{
|
||||
$this->template = $this->shared_template;
|
||||
}
|
||||
}
|
||||
|
@ -101,10 +85,12 @@ class Display_PHP extends Display_Common {
|
|||
* @todo Should there be additional logic to allow the module or the
|
||||
* template to determine whether or not the index should be loaded?
|
||||
*/
|
||||
if (file_exists($this->template_path . 'index.php')) {
|
||||
if (file_exists($this->template_path . 'index.php'))
|
||||
{
|
||||
require_once $this->template_path . 'index.php';
|
||||
}
|
||||
else if (file_exists($this->template)) {
|
||||
elseif (file_exists($this->template))
|
||||
{
|
||||
require_once $this->template;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue