$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");
$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'];
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 )
# 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';
}
<? foreach($entries as $entry): ?>
<?
- if (isset($entry['content_short']))
- $entry['content'] = $entry['content_short'] . '<br /><a class="more" href="'.$entry['url'].'">more →</a><br /><br />';
- $this->include_template('entry.html.tpl', array('entry' => $entry));
+ if (isset($entry['content_short']))
+ $entry['content'] = $entry['content_short'] . '<br /><a class="more" href="'.$entry['url'].'">more →</a><br /><br />';
+
+ $this->include_template('entry.html.tpl', array('entry' => $entry));
?>
<? endforeach; ?>
<div id="content">
- <?=$data['content'];?>
+ <?=$page['content'];?>
</div>
<? $this->include_template('nav.html.tpl') ?>
<div id="content">
- <? $this->include_template('entry.html.tpl', array('entry' => $entries)); ?>
+ <? $this->include_template('entry.html.tpl'); ?>
</div>
<? $this->include_template('footer.html.tpl') ?>