diff options
author | Bharat Mediratta <bharat@menalto.com> | 2008-11-04 05:02:37 +0000 |
---|---|---|
committer | Bharat Mediratta <bharat@menalto.com> | 2008-11-04 05:02:37 +0000 |
commit | 630b0f26fc5dc970d8634e58489c41c5a40481f1 (patch) | |
tree | 93dd3699d1681afeff0a41e2c5aded74353cccd8 /core/libraries | |
parent | 8709c1965f9b13967e74efddb7ff6c99e734a135 (diff) |
Restructure the theme code to be more like WordPress / Habari. Now,
the controller initiates a request to a top level page (eg:
album.html.php) which is then free to include whatever other page
chunks it wants with calls like <?= $theme->display('header.html') ?>
Variables like $item and $children are in the global space for all
views.
theme.php helper is now Theme.php library which lets us store the name
of the theme inside the variable itself. This means that the theme
does not have to know its own name because you can use $theme->url()
for all urls to stuff inside the theme itself, which makes it possible
to cline a theme without changing a single line.
Still using the mock album UI.
Diffstat (limited to 'core/libraries')
-rw-r--r-- | core/libraries/Theme.php | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/core/libraries/Theme.php b/core/libraries/Theme.php new file mode 100644 index 00000000..924e978c --- /dev/null +++ b/core/libraries/Theme.php @@ -0,0 +1,34 @@ +<?php defined("SYSPATH") or die("No direct script access."); +/** + * Gallery - a web based photo album viewer and editor + * Copyright (C) 2000-2008 Bharat Mediratta + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * This program 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 + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. + */ +class theme_Core { + private $theme_name = null; + + public function __construct($theme_name) { + $this->theme_name = $theme_name; + } + + public function url($path) { + return url::base() . "themes/{$this->theme_name}/$path"; + } + + public function display($page_name, $view_class="View") { + return new $view_class($page_name); + } +} |