All pastes #604915 Raw Edit

k4st

public php v1 · immutable
·published 2007-07-05 21:05 UTC
rendered paste body
<?phpif(!defined('IN_VALKYRIE')) {	exit;}class IndexController extends PageController {		// filters	public function getPreFilters() {		return array('options');	}		// routes	public function getRoutes() {		$routes = array();		$routes['index'] = '/(int)year/(int)month/(int)day/(int)title';				// total hack :P		$pages = $this->getFinder('posts')->findVisiblePages();				foreach($pages as $page) {			$routes[$page->post_name] = '/'. $page->post_name;		}				return $routes;	}		// default action	public function index(Request $request, Response $response) {				// viewing a post		if($request['year']) {					// viewing all posts		} else {			$response['posts'] = $this->getFinder('posts')->findAllVisible(1, $this['posts_per_page']);			$response['main'] = 'posts.html';		}	}		// allow for variable route names as per defined in getRoutes from	// the database pages that were added, eg: wordpress' "about" page	public function __call($fn, array $args = array()) {			}}