| Line | |
|---|
| 1 | <?php |
|---|
| 2 | |
|---|
| 3 | require_once 'classes/LightPressPlugin.php'; |
|---|
| 4 | |
|---|
| 5 | class AltTemplate extends LightPressPlugin { |
|---|
| 6 | |
|---|
| 7 | var $constructor_args = array( |
|---|
| 8 | 'template'=>'template to change, one of header/index/sidebar/footer', |
|---|
| 9 | 'template_file'=>'file to use instead of the LP default'); |
|---|
| 10 | var $default_context = LP_CONTEXT_POST; |
|---|
| 11 | var $description = 'Change one of the default templates in specific contexts'; |
|---|
| 12 | |
|---|
| 13 | var $active = true; |
|---|
| 14 | var $hooks = array('start_render'); |
|---|
| 15 | |
|---|
| 16 | var $template = 'sidebar'; |
|---|
| 17 | var $template_file = 'sidebar_alt.xml'; |
|---|
| 18 | |
|---|
| 19 | function AltTemplate(&$frontend, $args, $dummy_run=false) { |
|---|
| 20 | $this->LightPressPlugin($frontend, $args, $dummy_run); |
|---|
| 21 | } |
|---|
| 22 | |
|---|
| 23 | function run($hook, &$payload) { |
|---|
| 24 | if (isset($this->_frontend->templates[$this->template])) |
|---|
| 25 | $this->_frontend->templates[$this->template] = $this->template_file; |
|---|
| 26 | } |
|---|
| 27 | |
|---|
| 28 | } |
|---|
| 29 | |
|---|
| 30 | ?> |
|---|