Beispiel #1
0
	function get_child_pages ($slug) {
		
		$this->load_model('CmsPage');
		
		$page = CmsPage::meta()->one(array('slug' => $slug));
		
		if (!$page) {
			return array();
		}
		
		return CmsPage::meta()->filter(array('visible' => true))->all(array('parent' => $page->id));
		
	}
Beispiel #2
0
	function page ($path, $context = array()) {
		
		$cms_page = self::get_page($path);
		
		$slug = $cms_page->slug;
		$pk_lookup = array('parent' => $cms_page->get_pk());
		
		Frix::model('cms', 'CmsFile');
		Frix::model('cms', 'CmsImage');
		Frix::model('cms', 'CmsVideo');

		$context += array(
			'cms_page' => $cms_page,
			'cms_files' => CmsFile::meta()->all($pk_lookup),
			'cms_images' => CmsImage::meta()->all($pk_lookup),
			'cms_videos' => CmsVideo::meta()->all($pk_lookup),
			'cms_pages' => CmsPage::meta()->filter(array('visible' => True))->all($pk_lookup),
			'body_attrs' => array('id' => $slug),
		);
		
		$t = new Template('cms/custom/' . $slug, 'cms/page');
		echo $t->render($context);
		
	}