From: Gabriel Dunne Date: Mon, 3 Oct 2011 17:03:46 +0000 (+0530) Subject: Pages working, entries vs entry working X-Git-Url: https://git.quilime.com/?a=commitdiff_plain;h=6952d618dc0d18df8b4176732181df10f2986830;p=plog.git Pages working, entries vs entry working --- diff --git a/index.php b/index.php index 74c0a58..7b23f24 100644 --- a/index.php +++ b/index.php @@ -7,9 +7,13 @@ $request = get_request(); $v = new View ($request); $m = new Model ($request); -$v->assign('is_single', $m->is_single()); -$v->assign('is_page', $m->is_page()); -$v->assign('entries', $m->entries); + +if ($m->is_single()) + $v->assign('entry', $m->entry); +else if ($m->is_page()) + $v->assign('page', $m->page); +else if ($m->is_multiple()) + $v->assign('entries', $m->entries); header("Content-Type: {$m->response_mime_type}; charset=UTF-8"); diff --git a/lib/data.php b/lib/data.php index 9efbdd5..59367a5 100644 --- a/lib/data.php +++ b/lib/data.php @@ -141,7 +141,7 @@ function parse_entry($fileInfo, $page = false) $f['cat'] = $page ? null : array('name' => $clean_path, 'url' => $clean_path ); $f['path'] = $fileInfo->getRealPath(); - $f['url'] = ($page ? '' : $f['cat']['url']) . '/' . $fileInfo->getFilename(); + $f['url'] = ($page ? '' : $f['cat']['url'] . '/') . $fileInfo->getFilename(); if (!CLEAN_URLS) { $f['cat']['url'] = WEB_ROOT . '?p=' . $f['cat']['url']; @@ -159,7 +159,7 @@ function get_entry ( $relative_entry_path ) function get_page ( $relative_page_path ) { - return parse_entry(new SplFileInfo(join(array(LOCAL_ROOT, PAGE_DIR, $relative_page_path), DIRECTORY_SEPARATOR))); + return parse_entry(new SplFileInfo(join(array(LOCAL_ROOT, PAGE_DIR, $relative_page_path), DIRECTORY_SEPARATOR)), 1); } function parse_config ( $relative_path ) diff --git a/lib/model.php b/lib/model.php index e5e7e16..73a4ab9 100644 --- a/lib/model.php +++ b/lib/model.php @@ -47,17 +47,17 @@ class Model # if single entry (file in CONTENT dir) else if ($this->is_single()) { - $this->entries = get_entry( $this->content_request ); + $this->entry = get_entry( $this->content_request ); $this->template = 'single.' . $this->response_format . '.tpl'; } # if page (file in PAGES dir) else if ($this->is_page()) { - $this->entries = get_page( $this->page_request ); - $this->template = isset($page['config']['template']) ? - $this->entries['config']['template'] . '.' . $response_format . '.tpl' : - 'page.' . $response_format . '.tpl'; + $this->page = get_page( $this->page_request ); + $this->template = isset($this->page['config']['template']) ? + $this->page['config']['template'] . '.' . $this->response_format . '.tpl' : + 'page.' . $this->response_format . '.tpl'; } diff --git a/templates/default.html.tpl b/templates/default.html.tpl index e2e4d77..7b6927c 100644 --- a/templates/default.html.tpl +++ b/templates/default.html.tpl @@ -14,9 +14,10 @@ more →

'; - $this->include_template('entry.html.tpl', array('entry' => $entry)); + if (isset($entry['content_short'])) + $entry['content'] = $entry['content_short'] . '
more →

'; + + $this->include_template('entry.html.tpl', array('entry' => $entry)); ?> diff --git a/templates/page.html.tpl b/templates/page.html.tpl index 699aae9..137700c 100644 --- a/templates/page.html.tpl +++ b/templates/page.html.tpl @@ -12,7 +12,7 @@
- +
diff --git a/templates/single.html.tpl b/templates/single.html.tpl index 2af3963..a2fea66 100644 --- a/templates/single.html.tpl +++ b/templates/single.html.tpl @@ -11,7 +11,7 @@ include_template('nav.html.tpl') ?>
- include_template('entry.html.tpl', array('entry' => $entries)); ?> + include_template('entry.html.tpl'); ?>
include_template('footer.html.tpl') ?>