]> git.quilime.com - plog.git/commitdiff
Pages working, entries vs entry working
authorGabriel Dunne <gdunne@quilime.com>
Mon, 3 Oct 2011 17:03:46 +0000 (22:33 +0530)
committerGabriel Dunne <gdunne@quilime.com>
Mon, 3 Oct 2011 17:03:46 +0000 (22:33 +0530)
index.php
lib/data.php
lib/model.php
templates/default.html.tpl
templates/page.html.tpl
templates/single.html.tpl

index 74c0a58d47e127b8a11c6fac551ecc5bc16aea62..7b23f24a546d5628acb6eee3106c143109408ad9 100644 (file)
--- 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"); 
 
index 9efbdd59b59849e4318d1265084ab952f5850a33..59367a51b72f3af00f46a337caf8c5f1d11e6969 100644 (file)
@@ -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 )
index e5e7e165e4f2d4e344ee7da4707c2d239d7d7817..73a4ab934be5fb00bab5e56d03a05ded12f635d0 100644 (file)
@@ -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';
                }
 
 
index e2e4d77737aed3173870b5f166f48d82bf93b11f..7b6927c343a77f5c3266c166ecd4ad4d54e20bc9 100644 (file)
 
        <? foreach($entries as $entry): ?>
        <?  
-    if (isset($entry['content_short'])) 
-        $entry['content'] = $entry['content_short'] . '<br /><a class="more" href="'.$entry['url'].'">more &rarr;</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 &rarr;</a><br /><br />';
+
+        $this->include_template('entry.html.tpl', array('entry' => $entry)); 
     ?>
        <? endforeach; ?>       
        
index 699aae90737f5035587f849ce9b393c883451cd2..137700ca23c87367634deb6818b0616196df6a5b 100644 (file)
@@ -12,7 +12,7 @@
     
 <div id="content">
 
-       <?=$data['content'];?>
+       <?=$page['content'];?>
        
 </div>
 
index 2af39632a9c367130bd12c79ac96097b40f38821..a2fea66ccc8a8d3a175734f10faac2a7532c7aa9 100644 (file)
@@ -11,7 +11,7 @@
     <? $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') ?>