From: Gabriel Dunne Date: Sat, 10 Jul 2010 01:35:19 +0000 (-0700) Subject: updated templates and index X-Git-Url: https://git.quilime.com/?a=commitdiff_plain;h=f8578fa9aff278f186865501dd3e29c063d9c16e;p=plog.git updated templates and index --- diff --git a/content/projects/test_project b/content/projects/test_project new file mode 100644 index 0000000..bc74111 --- /dev/null +++ b/content/projects/test_project @@ -0,0 +1,4 @@ +title = placeholder project +date = 2010-07-07 +-- +test project \ No newline at end of file diff --git a/public/index.php b/public/index.php index f73f29e..e8b9d9f 100644 --- a/public/index.php +++ b/public/index.php @@ -4,42 +4,40 @@ $url_parts = get_url(); - list($response_format, $response_mime_type) = parse_format($url_parts['extension'], 'html'); - - $t = get_template_instance(); - $t->response_format = $response_format; - $t->assign('view', $_GET['v']); - - # content folder - if (is_dir(LOCAL_ROOT . CONTENT_DIR . DIRECTORY_SEPARATOR . $url_parts['url']) && $url_parts['url'] != "/") { - list($data, $total) = get_data(array($url_parts['url'])); - $t->assign('page_title', preg_replace('{^/|/$}', '', $url_parts['url'])); - $t->assign('data', $data); - } - # single file - else if (is_file( LOCAL_ROOT . CONTENT_DIR . $url_parts['dirname'] . DIRECTORY_SEPARATOR . $url_parts['filename'])) { - $t->assign('single', true); - $t->assign('data', parse_file(LOCAL_ROOT . CONTENT_DIR . $url_parts['dirname'] . DIRECTORY_SEPARATOR . $url_parts['filename'])); - $template = 'single.'.$response_format.'.tpl'; - } - # page - else if (is_file( LOCAL_ROOT . PAGE_DIR . DIRECTORY_SEPARATOR . $url_parts['filename'] )) { - $t->assign('data', parse_file(LOCAL_ROOT . PAGE_DIR . DIRECTORY_SEPARATOR . $url_parts['filename'])); - $template = 'page.' . $response_format . '.tpl'; - } - # direct template - else if (is_file( LOCAL_ROOT . TEMPLATE_DIR . DIRECTORY_SEPARATOR . $url_parts['filename'] .'.'. $response_format . '.tpl')) { - $template = $url_parts['filename'] . '.' . $response_format . '.tpl'; - } - # default (index) - else { - list($data, $total) = get_data(); - $t->assign('data', $data); - } - - - # render template - $t->assign('total', $total); + list($response_format, $response_mime_type) = parse_format($url_parts['extension'], 'html'); + + # setup template + $t = get_template_instance(); + $t->response_format = $response_format; + $t->assign('view', $_GET['v']); + + # is folder + if (is_dir(LOCAL_ROOT . CONTENT_DIR . $url_parts['url']) && $url_parts['url'] != "/") { + list($data, $total) = get_entries($url_parts['url']); + $t->assign('page_title', preg_replace('{^/|/$}', '', $url_parts['url'])); + $t->assign('data', $data); + } + # is file + else if (is_file( LOCAL_ROOT . CONTENT_DIR . $url_parts['url'])) { + $t->assign('single', true); + $t->assign('data', parse_entry(new SplFileInfo(LOCAL_ROOT . CONTENT_DIR . $url_parts['url']))); + $template = 'single.'.$response_format.'.tpl'; + } + # is page + else if (is_file( LOCAL_ROOT . PAGE_DIR . $url_parts['url'])) { + $page = parse_entry(new SplFileInfo(LOCAL_ROOT . PAGE_DIR . $url_parts['url']), 1); + $t->assign('data', $page); + $template = $page['config']['template'] ? $page['config']['template'] . '.' . $response_format . '.tpl' : 'page.' . $response_format . '.tpl'; + } + # default (all entries) + else { + list($data, $total) = get_entries(); + $t->assign('data', $data); + } + + # render + $t->assign('total', $total); header("Content-Type: {$response_mime_type}; charset=UTF-8"); - $t->render($template); + $t->render($template); + ?> diff --git a/templates/entry.html.tpl b/templates/entry.html.tpl index 0e8bab6..6994474 100644 --- a/templates/entry.html.tpl +++ b/templates/entry.html.tpl @@ -9,13 +9,16 @@ +
- posted in
+ posted in
+ + diff --git a/templates/nav.html.tpl b/templates/nav.html.tpl index ee3990e..94b92dd 100644 --- a/templates/nav.html.tpl +++ b/templates/nav.html.tpl @@ -4,13 +4,20 @@
- - -
  • +
  • projects
  • +
  • contact
  • +
  • blog
  • +
  • cv
  • + + 0)); ?> + +
  • - -
  • + +
  • + */ ?> diff --git a/templates/single.html.tpl b/templates/single.html.tpl index ccb8623..e169285 100644 --- a/templates/single.html.tpl +++ b/templates/single.html.tpl @@ -3,7 +3,7 @@ include_template('head-inc.html.tpl') ?> - <?=SITE_TITLE?><?=$this->title(); ?> + <?=SITE_TITLE?>, <?=$data['title'];?>