LightPressPlugin($frontend, $args, $dummy_run); } function run($hook, &$templates) { $f =& $this->_frontend; if (!$this->active) return; /* get category name & build template filename */ $context =& $f->context; switch ($context['type']) { case 'category': //use category "nicename" $categories =& $f->getCategories(); if (isset($categories[$context['filter']]['category_nicename'])) $catname = $categories[$context['filter']]['category_nicename']; break; default: //unsupported context, try filter value and go for broke $catname = $context['filter']; // should work for pages break; } if (!isset($catname)) return; $catplate = strtolower($f->context['type'] . '-' . $catname . '.xml'); /* switch main template if category template exists */ $themedir =& $f->tpl->root; if (is_dir($themedir) && file_exists($themedir . '/' . $catplate) ) $templates['index'] = $catplate; $this->active = false; return; } function hide() { // do nothing } } ?>