]> git.quilime.com - plog_bk.git/commitdiff
major template updates, organization, wip
authorGabriel Dunne <gdunne@quilime.com>
Sun, 27 Jun 2010 07:07:14 +0000 (00:07 -0700)
committerGabriel Dunne <gdunne@quilime.com>
Sun, 27 Jun 2010 07:07:14 +0000 (00:07 -0700)
25 files changed:
README [new file with mode: 0644]
css/style.css
css/style2.css [new file with mode: 0644]
index.php
js/prettify/prettify.css
lib/data.php
lib/init.php
lib/output.php
lib/static.php
lib/template.php [new file with mode: 0644]
templates/404.html [deleted file]
templates/404.html.tpl [new file with mode: 0644]
templates/about.html.tpl [moved from templates/about.html with 100% similarity]
templates/agg.html [deleted file]
templates/code copy 2.html [moved from templates/code.html with 100% similarity]
templates/code copy.html [new file with mode: 0644]
templates/code.html.tpl [new file with mode: 0644]
templates/entry.html.tpl [new file with mode: 0644]
templates/footer.html.tpl [new file with mode: 0644]
templates/head-inc.html.tpl [new file with mode: 0644]
templates/index.html.tpl [new file with mode: 0644]
templates/index.json.tpl [new file with mode: 0644]
templates/links.html.tpl [moved from templates/links.html with 95% similarity]
templates/log.html.tpl [moved from templates/log.html with 64% similarity]
templates/nav.html

diff --git a/README b/README
new file mode 100644 (file)
index 0000000..e69de29
index f84fab6c82a6a50010e8451ded45a14d26a7c7a8..3aff87e98af976303011ba9171f82b5aabf13e6e 100644 (file)
@@ -1,28 +1,27 @@
 body { margin:80px 100px 50px 40px; }
-html, body, table { font-family: monaco, monospace; font-size:12px; line-height:1.6em; color:#444; }
+html, body, table { font-family: monospace; font-size:12px; line-height:1.6em; color:#666; }
 
-
-.nav { position:absolute; z-index:1; top:20px; left:20px;  }
+.nav { position:absolute; z-index:1; top:20px; left:30px;  }
 .nav ul { margin-left:1em; }
 .nav h1 { margin-bottom:50px;}
 
-#head { position:absolute; top: 20px; left: 160px;}
+#head { position:absolute; top: 20px; left: 160px; }
 
 /*selection*/
 ::-moz-selection {background: #08f !important; color:#fff;} 
 ::selection {background: #08f !important; color:#fff;} 
 
 /*links*/
-a { color:#555; border:0; padding:0.2em 0.1em 0 0; font-weight:bold;  }
+a { color:#000; border:0; padding:0.2em 0.1em 0 0;  }
 a img { border:0; }
 a.mute { text-decoration:none !important; }
-a:hover, a.mute:hover { color:#d15; }
+a:hover, a.mute:hover { color:#d15; text-decoration:none; }
 
 /*headings*/
-h1, h2, h3, h4, h5, h6 {  font-size:1.2em; }
+h1, h2, h3, h4, h5, h6 {  font-size:1em; }
 h1 a, h2 a, h3 a, h4 a, h5 a, h6 a { text-decoration:none; }
-h1 { margin:0 0 3em 0; font-size:2em;}
-h2 { margin:4em 0 0.5em 0;  }
+h1 { margin:0 0 3em 0; }
+h2 { margin:0 0 0.5em 0;  }
 h3 { margin:0 0 0 0; }
 
 ol li { list-style-type:decimal; }
@@ -44,6 +43,8 @@ table .reader li, table .bookmarks li { margin-bottom:1em; padding-bottom:1em;
 .bookmark_links li span { font-style: italic; color:#444; }
 .image li a { background:none;}
 
+table.archive td {padding-right:20px; }
+
 .c_pop { position:absolute; background:#fff; display:none; border:5px outset #000; padding:1em 2em; z-index:5; } 
 
 .func { font-weight:bold; color:#444; }
@@ -76,10 +77,8 @@ table .reader li, table .bookmarks li { margin-bottom:1em; padding-bottom:1em;
     .text { font-family:serif; font-size:15px; line-height:2.2em;  margin-top:80px;}
     .indent { text-indent:3em; }
     
-
-
-
-
+.entry { margin-bottom:100px; }
+.entry h2 { border-bottom:1px solid #ddd; padding-bottom:4px; }
     
 .caption { font-style:italic; margin-top:5px; color:#444; }
 .more, .home { text-decoration:none; color:#000; font-weight:bold; }
diff --git a/css/style2.css b/css/style2.css
new file mode 100644 (file)
index 0000000..1536ba7
--- /dev/null
@@ -0,0 +1,86 @@
+body { margin:80px 100px 50px 40px; }
+html, body, table { font-family: helvetica; font-size:11px; line-height:1.5em; color:#999; }
+
+.nav { position:absolute; z-index:1; top:20px; left:20px; line-height:1.3em;}
+.nav ul { margin-left:1em; }
+.nav h1 { margin-bottom:50px;}
+
+#head { position:absolute; top: 20px; left: 160px;}
+
+/*selection*/
+::-moz-selection {background: #08f !important; color:#fff;} 
+::selection {background: #08f !important; color:#fff;} 
+
+/*links*/
+a { color:#555; border:0; padding:0.2em 0.1em 0.1em 0em; font-weight:bold; text-decoration:none; }
+a img { border:0; }
+a.mute { }
+a:hover, a.mute:hover { color:#d15; border-bottom:2px solid #d15;  text-decoration:none;  }
+
+/*headings*/
+h1, h2, h3, h4, h5, h6 {  font-size:1.3em; }
+h1 a, h2 a, h3 a, h4 a, h5 a, h6 a { text-decoration:none; }
+h1 { margin:0 0 3em 0; font-size:2em;}
+h2 { margin:4em 0 0.5em 0;  }
+h3 { margin:0 0 0 0; }
+
+blockquote { font-family:times; background:#000; color:#aaa;
+margin:0; font-size:15px; line-height:1.4em; padding:2em 4em; font-style:italic; line-height:1.45em; max-width:600px;}
+
+p { max-width:720px; }
+
+ul, li { margin:0; padding:0; list-style-type:none; }
+table { margin:0; padding:0; border:0;  }
+table .column { padding-right:100px; min-width:120px; max-width:400px; }
+table .column h2 a { text-decoration:none; }
+table h2, table h3 { margin-bottom:2em;}
+table .video li, table .image li { margin-bottom:2em; }
+table .reader li, table .bookmarks li { margin-bottom:1em; padding-bottom:1em;  border-bottom:1px dotted #ddd; }
+.reader_links li, .bookmark_links li { padding-top:.75em; margin-bottom:.75em; }
+.bookmark_links li a { display:block; }
+.bookmark_links li span { font-style: italic; color:#444; }
+.image li a { background:none;}
+
+.c_pop { position:absolute; background:#fff; display:none; border:5px outset #000; padding:1em 2em; z-index:5; } 
+
+.func { font-weight:bold; color:#444; }
+
+#home_arrow { position: absolute; top:11px; left:23px; margin-left:250px; text-decoration:none; }
+
+#content { margin-left:120px; min-width:500px; position:absolute; top:20px; padding-bottom:200px; z-index:10;}
+    #content p {  }
+    ul.inline_content {}
+    ul.inline_content li .content { } 
+    ul.inline_content li { margin:0 0 150px 0; }
+    ul.inline_content li h3 { border-bottom:2px solid #ddd; }
+    ul.inline_content ol li { margin:0; padding:0; border:0;}
+    ul.thumbnails    { }
+    ul.thumbnails li { display:inline-block; margin: 0px 60px 60px 0px; }
+    ul.thumbnails .thumbnail { width:160px; height:120px; text-align:center; background:#888; }
+    ul.thumbnails a:hover img { 
+        filter:alpha(opacity=75);
+        -moz-opacity:0.75;
+        -khtml-opacity: 0.75;
+        opacity: 0.75;
+    }     
+    ul.thumbnails a { text-decoration:none;  }   
+    ul.thumbnails .title {  }
+    
+    .date { color:#ccc;}    
+       .func { margin-bottom:2em; }
+       .func a { background:#daa;  padding:0.2em 1em 0.02em 1em; font-size:9px; text-transform:uppercase;}
+
+    .text { font-family:serif; font-size:15px; line-height:2.2em;  margin-top:80px;}
+    .indent { text-indent:3em; }
+    
+
+
+
+
+    
+.caption { font-style:italic; margin-top:5px; color:#444; }
+.more, .home { text-decoration:none; color:#000; font-weight:bold; }
+
+#footer {  margin-top:120px; }    
+#footer .copy a { text-decoration:none; }
+
index 7fee15314b0cbd8200799770a01d394cb2db8e90..7df8b0b6946c5831de74768773dc3ddc9ba0d7c0 100644 (file)
--- a/index.php
+++ b/index.php
@@ -2,28 +2,57 @@
 
     require_once 'lib/init.php';
 
-    $url_string = get_url_string();
+    $url_parts = get_url();
 
-    if (is_string($url_string)) {
+//     print_r($url_parts);
+       
+//     echo "<br/><br/>";
 
-       if ( basename($url_string) == "aggregate") {
-               header ("Location: http://quilime.com/aggregate/index.php");
-               exit;
-       }
-        else if (is_file ( TEMPLATE_DIR . basename($url_string) . '.html' )) {
-            include ( TEMPLATE_DIR . basename($url_string) . '.html' );
+       list($response_format, $response_mime_type) = parse_format($url_parts['extension'], 'html');    
+       
+       $t = get_template_instance();   
+       
+       $view = isset($_GET['v']) ? $_GET['v'] : 'inline';
+
+    if (is_string($url_parts['basename'])) 
+       {
+
+               # base content folder
+               if (is_dir  ( CONTENT_DIR . DIRECTORY_SEPARATOR . $url_parts['basename'])) {
+                       
+                       list($items, $total) = get_data(array($url_parts['basename']));                 
+                       $t->assign('items', $items);
+                       $t->assign('total', $total);
+                       $t->assign('view', $view);
+                       $t->render($url_parts['basename'] . '.' . $response_format . '.tpl');
             exit;
         }
-        else if (dirname($url_string) != '.' && is_dir(CONTENT_DIR . dirname($url_string))) {
-            include( TEMPLATE_DIR . dirname($url_string) . '.html' );
+
+               # single entry
+        else if ($url_parts['dirname'] != '.' && is_dir(CONTENT_DIR . $url_parts['dirname'])) {
+       
+                       $t->assign('single', true);
+                       $t->assign('item', parse_config(CONTENT_DIR . $url_parts['dirname'] . DIRECTORY_SEPARATOR . $url_parts['filename']));
+                       $t->assign('content', $url_parts['dirname'] . DIRECTORY_SEPARATOR . $url_parts['filename']);
+                       
+                       $t->render($url_parts['dirname'] . '.' . $response_format . '.tpl');    
             exit;
         }
+
+               # not found
         else  {
-            include( TEMPLATE_DIR . '404.html' );
+                       $t->render('404.'.$response_format.'.tpl');
             exit;
         }
+
     }
 
-    include ( TEMPLATE_DIR . 'index.html' );
+
+       # render all entries inline
+       list($entries, $total) = get_inline_entries(array('log', 'code'));      
+       
+       $t->assign('entries', $entries);
+       $t->assign('total', $total);
+       $t->render('index.'.$response_format.'.tpl');
 
 ?>
index f38550c729ddb52ad19be7229cc3564477f93665..90200e12016466c22f0ee93a7b78d5eae3b8ecbd 100755 (executable)
@@ -11,7 +11,7 @@
 .atn { color: #606; }
 .atv { color: #080; }
 .dec { color: #606; }
-pre.prettyprint, code.prettyprint { font-family:monaco, "Lucida Console", monospace; font-size:12px; line-height:2em; padding:0.4em 0.6em; background:#322323;
+pre.prettyprint, code.prettyprint { font-family:monaco, "Lucida Console", monospace; font-size:12px; line-height:2em; padding:0.4em 0.6em; background:#222333;
 -moz-border-radius: 8px;
 -webkit-border-radius: 8px;
 }
index df828523baf662e4b5bea0792dee1a08fbd0b32a..20ecec107e42c443608cc1021b5f3cb063ec6a49 100644 (file)
 <?php
 
-    function list_content($path, $args="")
-    {
-        list($list, $total) = get_content($path, $args);
-        $ret = array();
-        foreach($list as $l) {
-            $ret[] = '<li><a href="'. $l['href'] .'">' . $l['title'] . '</a></li>'; 
-        }
-        return join("\n", $ret);
+
+# parse inline content
+function get_data( $sources,  $params = array() )
+{
+       $result = array();
+       $result_total = 0;
+       foreach ($sources as $dir) {
+               $contents = glob(LOCAL_ROOT . CONTENT_DIR . DIRECTORY_SEPARATOR . $dir . '/*');
+               foreach ($contents as $f) {
+                       if (!is_dir($f)) {
+                               
+                               if ($params['name']) {                                  
+                                       if (basename($f) != $params['name'])
+                                               continue;
+                               }
+                               
+                               $file_contents = explode("\n", file_get_contents($f, FILE_USE_INCLUDE_PATH));
+                               $cc = "";
+                               $content = "";
+                               $conf = true;
+                               foreach ( $file_contents as $fc ) {
+                                       if ($fc == CONFIG_DELIMITER) {  
+                                               $conf = false;
+                                               continue;
+                                       }
+                                       if ($conf) $cc .= $fc . "\n";
+                                       else $content .= $fc . "\n";
+                               }
+                               
+                               $config = parse_ini_string($cc);
+                               
+                               $config['url'] = WEB_ROOT . DIRECTORY_SEPARATOR . $dir . DIRECTORY_SEPARATOR . basename($f);
+                               $config['timestamp'] = mktime($config['date']);
+                               $config['category'] = $dir;
+                               $config['content'] = $content;
+                               $config['tags'] = explode(' ', $config['tags']);
+                               
+                               $result[] = $config;
+                               $result_total++;
+                       }
+               }
+       }
+       
+       // order by date
+       foreach ($result as $key => $row) {
+           $time[$key]  = $row['date'];
+       }
+       array_multisort($time, SORT_DESC, $result);
+       
+       return array($result, $result_total);
+}
+
+
+
+
+function list_content($path, $args="")
+{
+    list($list, $total) = get_content($path, $args);
+    $ret = array();
+    foreach($list as $l) {
+        $ret[] = '<li><a href="'. $l['href'] .'">' . $l['title'] . '</a></li>'; 
     }
+    return join("\n", $ret);
+}
 
 
-    function get_content ($path, $args="")
-    {   
-        parse_str($args, $args);
-        
-        $type = isset($args['type']) ? $args['type'] : 'folder';
-        $config = $type == 'folder' ? $c . '/config' : $c;
-        
-        $content = array();
-        $glob = glob( CONTENT_DIR . $path . '/*' );
+function get_content ($path, $args="")
+{   
+    parse_str($args, $args);
+    
+    $type = isset($args['type']) ? $args['type'] : 'folder';
+    $config = $type == 'folder' ? $c . '/config' : $c;
+    
+    $content = array();
+    $glob = glob( CONTENT_DIR . $path . '/*' );
 
-        
-        foreach ($glob as $c) {
-            if (is_file($c . $config) || is_dir($c . $config)) {
-                $config_array = parse_config($c . $config);
-                if ($config_array['title'] && $config_array['hide'] != "true") {
-                    $content[] = $config_array;
-                }
+    
+    foreach ($glob as $c) {
+        if (is_file($c . $config) || is_dir($c . $config)) {
+            $config_array = parse_config($c . $config);
+            if ($config_array['title'] && $config_array['hide'] != "true") {
+                $content[] = $config_array;
             }
         }
-        return array(array_reverse($content), count($content));
     }
+    return array(array_reverse($content), count($content));
+}
     
     
-    function parse_config ($config_file)
-    {
-        $config = array();   
-        
-        $config_settings = explode("\n", file_get_contents( $config_file , FILE_USE_INCLUDE_PATH ));
+function parse_config ($config_file)
+{
+    $config = array();   
+    
+    $config_settings = explode("\n", file_get_contents( $config_file , FILE_USE_INCLUDE_PATH ));
 
-        $break = false;
-        foreach ( $config_settings as $c ) 
-        {    
-            if ($c == '--') {
-                $break = true;
-                $config['inline_content'] = "";
-                continue;            
-            }
-            
-            if ($break) {
-                $config['inline_content'] .= $c;                
-            }
-            else {
-                $conf = explode("=", $c);
-                $config[trim($conf[0])] = trim($conf[1]);
-            }    
+    $break = false;
+    foreach ( $config_settings as $c ) 
+    {    
+        if ($c == '--') {
+            $break = true;
+            $config['inline_content'] = "";
+            continue;            
         }
         
-        if ($config['thumb'] && is_file( dirname($config_file) . '/' . $config['thumb'] )) {
-            $config['thumb'] = get_base_dir() . '/' . dirname($config_file) . '/' . $config['thumb'];
-        } 
-        else if (is_file(get_base_dir() . '/' . dirname($config_file) . '/thumb.png')) {
-            $config['thumb'] = get_base_dir() . '/' . dirname($config_file) . '/thumb.png';
+        if ($break) {
+            $config['inline_content'] .= $c;                
         }
-        
-        $config['timestamp'] = strtotime($config['date']);
+        else {
+            $conf = explode("=", $c);
+            $config[trim($conf[0])] = trim($conf[1]);
+        }    
+    }
+    
+    if ($config['thumb'] && is_file( dirname($config_file) . '/' . $config['thumb'] )) {
+        $config['thumb'] = get_base_dir() . '/' . dirname($config_file) . '/' . $config['thumb'];
+    } 
+    else if (is_file(get_base_dir() . '/' . dirname($config_file) . '/thumb.png')) {
+        $config['thumb'] = get_base_dir() . '/' . dirname($config_file) . '/thumb.png';
+    }
+    
+    $config['timestamp'] = strtotime($config['date']);
 
-        $config['content'] = is_file( dirname($config_file) . '/' . $config['content'] ) ? 
-                                dirname($config_file) . '/' . $config['content'] : 
-                                dirname($config_file) . '/content.html';
+    $config['content'] = is_file( dirname($config_file) . '/' . $config['content'] ) ? 
+                            dirname($config_file) . '/' . $config['content'] : 
+                            dirname($config_file) . '/content.html';
 
-        $config['href'] = basename($config_file) == 'config' ? 
-                            get_base_dir() . '/' . str_replace(CONTENT_DIR, "", dirname($config_file)) : 
-                            get_base_dir() . '/' . str_replace(CONTENT_DIR, "", $config_file);
-                            
-        $config['base_dir'] = get_base_dir() . '/' . CONTENT_DIR . $config['href'];
-        
-        return $config;
-    }
+    $config['href'] = basename($config_file) == 'config' ? 
+                        get_base_dir() . '/' . str_replace(CONTENT_DIR, "", dirname($config_file)) : 
+                        get_base_dir() . '/' . str_replace(CONTENT_DIR, "", $config_file);
+                        
+    $config['base_dir'] = get_base_dir() . '/' . CONTENT_DIR . $config['href'];
+    
+    return $config;
+}
     
     
     
-    function define_constants($constants = 'config')
-    {
-        $config = explode("\n", file_get_contents( $constants , FILE_USE_INCLUDE_PATH ));
-        foreach($config as $c) {
-            $var = explode("=", $c);
-            define(trim($var[0]), trim($var[1]));
-        }        
-    }    
+function define_constants($constants = 'config')
+{
+    $config = explode("\n", file_get_contents( $constants , FILE_USE_INCLUDE_PATH ));
+    foreach($config as $c) {
+        $var = explode("=", $c);
+        define(trim($var[0]), trim($var[1]));
+    }        
+}    
     
     
 
index 7807a1740c922989a1bd7dc9d81077281bb4a30e..a90c832ead2f605a541685d9b6000905d0b66c74 100644 (file)
@@ -6,14 +6,15 @@
 
        define ('SITE_TITLE', 'quilime');
        define ('LOCAL_ROOT', '/home/quilime/quilime.com/');
-       define('WEB_ROOT', 'http://quilime.com/');
-       define ('CONTENT_DIR', 'content/');
-       define ('TEMPLATE_DIR', 'templates/');
+       define('WEB_ROOT', 'http://quilime.com');
+       define ('CONTENT_DIR', 'content');
+       define ('TEMPLATE_DIR', 'templates');
        define ('CONFIG_DELIMITER', '--');      
        
     require_once 'data.php';
     require_once 'output.php'; 
-    
+    require_once 'template.php';       
+
     define_constants();
     
 ?>
\ No newline at end of file
index 386713e036c1191f37ae01c28358575fec5eae12..112c083382d4c01932bddfc18eb2468b0f03ff02 100644 (file)
@@ -1,6 +1,14 @@
 <?php
 
 
+       function get_template_instance()
+       {
+           $t = new Template();
+           $t->template_dir = join(DIRECTORY_SEPARATOR, array(dirname(__FILE__), '..', 'templates'));  
+           return $t;
+       }
+
+
    /**
     * @param    string  $format     "text", "xml", etc.
     * @param    string  $default    Default format
                return $array;
            }
        }
+           
+       
+       function get_url_parts()
+       {        
+               $parts = explode('/', substr($_SERVER['SCRIPT_URL'], strlen(get_base_dir() . '/')));        
+               return $parts[0] ? $parts : 0;
+       }
+       
     
-    
-    function get_url_parts()
-    {        
-        $parts = explode('/', substr($_SERVER['SCRIPT_URL'], strlen(get_base_dir() . '/')));        
-        return $parts[0] ? $parts : 0;
-    }
-    
-    
-    function get_url_string()
+    function get_url()
     {
-        return substr($_SERVER['SCRIPT_URL'], strlen(get_base_dir() . '/'));
+        return pathinfo($_SERVER['SCRIPT_URL']); //substr($_SERVER['SCRIPT_URL'], strlen(get_base_dir() . '/'));
     }
     
     
index efb18fab121c0f9dbfd31a6a75ce3cec87456496..ea0082eb7bd983a734f0a73b938e1e455aea9c1b 100644 (file)
        }
        echo '</ol>';
        
-       
-       # parse inline content
-       function get_inline_entries( $sources )
-       {
-               $result = array();
-               $result_total = 0;
-               foreach ($sources as $dir) {
-                       $contents = glob(LOCAL_ROOT . CONTENT_DIR . $dir . '/*');
-                       foreach ($contents as $f) {
-                               if (!is_dir($f)) {
-                                       $file_contents = explode("\n", file_get_contents($f, FILE_USE_INCLUDE_PATH));
-                                       $cc = "";
-                                       $content = "";                                  
-                                       $conf = true;
-                                       foreach ( $file_contents as $fc ) {
-                                               if ($fc == CONFIG_DELIMITER) {  
-                                                       $conf = false;
-                                                       continue;
-                                               }
-                                               if ($conf) $cc .= $fc . "\n";
-                                               else $content .= $fc . "\n";
-                                       }
-                                       $config = parse_ini_string($cc);
-                                       
-                                       $config['url'] = WEB_ROOT . $dir . DIRECTORY_SEPARATOR . basename($f);
-                                       $config['timestamp'] = mktime($config['date']);
-                                       $config['category'] = $dir;
-                                       $config['content'] = $content;
-                                       $config['tags'] = explode(' ', $config['tags']);
-                                       
-                                       $result[] = $config;
-                                       $result_total++;
-                               }
-                       }
-               }
                
-               // order by date
-               foreach ($result as $key => $row) {
-                   $time[$key]  = $row['date'];
-               }
-               array_multisort($time, SORT_DESC, $result);
-               
-               return array($result, $result_total);
-       }
-
-
-
-       $files = glob('../content/log/*');
-       
-       $result = array();
-       $result['count'] = 0;
-       foreach ($files as $f)
-       {
-               if (!is_dir($f)) {
-                       
-                       $config_settings = explode("\n", file_get_contents($f, FILE_USE_INCLUDE_PATH));
-                       
-                       $cc = "";
-                       $content = "";
-                       $past_conf = false;
-               foreach ( $config_settings as $c ) {    
-                               if ($c == CONFIG_DELIMITER) {
-                                       $past_conf = true;
-                                       continue;
-                               }
-                               if ($past_conf) $content .= $c . "\n";
-                               else $cc .= $c . "\n";                          
-                       }
-                       $config = parse_ini_string($cc);
-                       $config['content'] = $content;                  
-                       
-                       if ($config['hide'] == 'true')
-                               continue;
-                                               
-                       $result['count'] += 1;
-                       $result['entries'][] = $config;
-                       
-//                     print_r($cc);
-//                     echo "content: " . $content;
-                       
-//                     echo $config;
-//                     echo "\n";
-               }                       
-       }
-       
-//     echo json_encode($result);
-       
-//     print_r($entries);
-
-
 
 
 
diff --git a/lib/template.php b/lib/template.php
new file mode 100644 (file)
index 0000000..5be035b
--- /dev/null
@@ -0,0 +1,43 @@
+<?php
+
+class Template
+{
+       var $template_dir = 'templates';
+       
+       var $_tpl_vars = array();
+
+       
+       function __construct()
+       {
+               
+       }
+       
+       
+    function assign($tpl_var, $value = null)
+    {
+        if (is_array($tpl_var)) {
+            foreach ($tpl_var as $key => $val)
+                if ($key != '')
+                    $this->_tpl_vars[$key] = $val;
+        } else {
+            if ($tpl_var != '')
+                $this->_tpl_vars[$tpl_var] = $value;
+        }
+    }
+
+
+       public function include_template ($template, $vars = array())
+       {
+               $this->_tpl_vars = array_merge($this->_tpl_vars, $vars);
+               $this->render($template);
+       }
+       
+
+       public function render( $template )
+       {
+               extract( $this->_tpl_vars );    
+               include( $this->template_dir . DIRECTORY_SEPARATOR  . $template );
+       }
+}
+
+?>
\ No newline at end of file
diff --git a/templates/404.html b/templates/404.html
deleted file mode 100644 (file)
index 6cf670a..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-<html>
-
-<head>
-
-    <?php include_template('header-src.html'); ?>
-
-    <title><?php echo SITE_TITLE; ?> :404</title>
-    
-</head>
-
-<body>
-    
-    <?php include_template('nav.html'); ?>
-
-    <div id="content">
-        
-        <h1>oops</h1>
-        
-        <p>
-        404
-        </p>
-        
-    </div>
-    
-</body>
-
-</html>
\ No newline at end of file
diff --git a/templates/404.html.tpl b/templates/404.html.tpl
new file mode 100644 (file)
index 0000000..ac9a892
--- /dev/null
@@ -0,0 +1,22 @@
+<html>
+<head>
+    
+    <?php $this->include_template('head-inc.html.tpl'); ?>
+    
+    <title><?=SITE_TITLE?></title>
+    
+</head>
+<body>
+    
+    <? $this->include_template('nav.html'); ?>
+    
+<div id="content">
+
+       oops. 404.
+       
+</div>
+
+       <? $this->include_template('footer.html.tpl'); ?>
+
+</body>
+</html>
diff --git a/templates/agg.html b/templates/agg.html
deleted file mode 100644 (file)
index a00a0c2..0000000
+++ /dev/null
@@ -1,149 +0,0 @@
-<?
-       $page = "aggregate";
-?>
-
-<html>
-
-<head>
-    
-    <?php include_template('header-src.html'); ?>
-    
-    <title><?php echo SITE_TITLE; ?> - aggregate</title>
-    
-    <link rel="alternate" type="application/rss+xml" title="aggregate" href="http://media.quilime.com/aggregate/?return=rss" />    
-    
-</head>
-
-<body>
-    
-    <?php include('nav.html'); ?>
-    
-    <div id="content">
-    
-    <table border="0" id="agg"><tr>
-
-        <td valign="top" class="column">
-        <?php $agg = get_rss_feed('http://media.quilime.com/aggregate/index.php?return=rss'); ?>
-        <h3><a class="mute" href="http://media.quilime.com/aggregate/">image aggregate</a></h3>
-        <ul class="image">
-
-        <?php 
-        $count = 10;
-        foreach($agg->channel->item as $item) :  
-        if ($count-- == 0) break;
-        ?>    
-        <li title="<?php echo $item->title; ?>">
-            <a href="<?php echo $item->link; ?>">
-                <img src="<?php echo $item->thumb; ?>">
-            </a>
-        </li>
-        <? endforeach; ?>  
-        </ul>
-        <p>
-            <a class="more" href="http://media.quilime.com/aggregate" title="via quilime.com/aggregate">more &rarr;</a>            
-        </p>
-
-        </td>
-
-
-<?php /*    
-        <td valign="top" class="column">
-        <?php $tube = get_rss_feed('http://gdata.youtube.com/feeds/base/users/kabr/favorites?alt=rss&v=2&orderby=published&client=ytapi-youtube-profile'); ?>
-        <h2><a href="http://www.youtube.com/profile?user=kabr&view=favorites">video </a></h2>
-        <ul class="video">
-        <?php 
-        $count = 11;
-        foreach($tube->channel->item as $tube) :  
-        if ($count-- == 0) break;
-        ?>    
-        <li title="<?php echo str_replace('"', '\'', $tube->title); ?>">
-            <? 
-            $url = $tube->link;
-            $pattern = '/v=(.+?)&/';
-            preg_match($pattern, $url, $matches);
-            $id = $matches[1];
-            ?>
-            <a href="<?php echo $tube->link; ?>">
-
-            <img src="http://i3.ytimg.com/vi/<?=$id?>/default.jpg" />
-            </a>
-        </li>
-        <? endforeach; ?>  
-        </ul>
-        <p>
-            <a class="more" href="http://www.youtube.com/profile?user=kabr&view=favorites" title="via youtube">more &rarr;</a>            
-        </p>
-        </td>
-*/ ?>
-        
-
-        
-
-
-        <td valign="top" class="column">
-        <?php
-        
-               $url = 'https://api.del.icio.us/v1/posts/recent?count=20';
-               $ch = curl_init();
-               curl_setopt($ch, CURLOPT_URL, $url);
-               curl_setopt($ch, CURLOPT_POST, 1);
-               curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
-               curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
-               curl_setopt($ch, CURLOPT_TIMEOUT, 5);
-               curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
-               curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
-               // add delicious.com username and password below
-               curl_setopt($ch, CURLOPT_USERPWD, 'quilime:redsink67');
-               $data = curl_exec($ch);
-               curl_close($ch);     
-               $del = new SimpleXMLElement($data);   
-        
-        ?>
-        <h3><a class="mute" href="http://delicious.com/quilime/">bookmarks</a></h3>
-        <ul class="bookmarks">
-        <?php foreach($del->post as $d) : ?>
-        <li>
-            <a href="<?=$d['href']?>"><?=$d['description'];?></a>
-            <br/>
-
-            <span class="desc"><?=$d['extended'];?></span>
-        </li>
-        <? endforeach; ?>       
-        </ul>
-        <p>
-            <a class="more" href="http://delicious.com/quilime/" title="via delicious">more &rarr;</a>            
-        </p>
-        </td>
-        
-        <? /*
-
-        <td valign="top" class="column">
-        <?php $read = get_rss_feed('http://www.google.com/reader/public/atom/user%2F10925293898931913532%2Fstate%2Fcom.google%2Fbroadcast'); ?>
-        <h2><a href="http://www.google.com/reader/shared/10925293898931913532">reader </a></h2>
-        <ul class="reader">
-        <?php foreach($read->entry as $item) :  ?>    
-        <li>
-            <a href="<?php echo $item->link['href']; ?>"><?php echo $item->title; ?></a>
-        </li>
-
-        <? endforeach; ?>  
-        </ul>
-        <p>
-            <a class="more" href="http://www.google.com/reader/shared/10925293898931913532" title="via google reader">more &rarr;</a>            
-        </p>
-        </td>
-        
-        */ 
-        ?>
-
-
-        
-
-        </tr></table>
-        
-    </div>
-
-    
-</body>
-
-</html>
\ No newline at end of file
diff --git a/templates/code copy.html b/templates/code copy.html
new file mode 100644 (file)
index 0000000..63aa896
--- /dev/null
@@ -0,0 +1,112 @@
+<?php
+
+    $items = array();
+    $single = false;
+    
+    if (is_dir(CONTENT_DIR . $url_string) && !is_file(CONTENT_DIR . $url_string . '/config') ) {
+        list($items_list, $total) = get_content(basename($url_string));
+    }
+    else {
+        $config = parse_config(CONTENT_DIR . $url_string . '/config');
+        $items = $config;
+        $single = true;
+    }
+
+       $inline = isset($_GET['inline']) ? true : false;
+       
+       $page = "code";
+
+
+?>
+<html>
+
+<head>
+    <?php include_template('header-src.html'); ?>
+    <script src="/js/jquery-1.3.2.min.js"></script>
+    
+    <title><?php echo SITE_TITLE; ?> - code<?php if (sizeof($items) > 0 ) : ?>: <?echo strtolower($items['title']); ?> [<?php echo $items['medium']; ?>]<?php endif; ?></title>
+        
+</head>
+
+<body>
+    
+    <?php 
+        include('nav.html');         
+    ?>
+
+
+
+    <div id="content">
+       
+
+        <?php if ($single) : ?>
+
+            <div class="content">
+                <?php 
+                    $base_dir = $items['base_dir'];
+                    include_once($items['content']); 
+                ?>
+            </div>
+       
+        <?php elseif ($inline): ?>
+       
+<div class="func"><a href="/code/">list</a></div>              
+       
+            <ul class="inline_content">
+            <?php foreach($items_list as $items): ?>
+                   <li>
+                       <h3>
+                           <a href="<?php echo $items['href']?>"><?php echo $items['title']; ?></a>
+                    </h3>
+                    <div class="content">
+                    <?php 
+                        $base_dir = $items['base_dir'];
+                        include( $items['content'] ); 
+                    ?>
+                    </div>
+                </li>
+            <?  endforeach; ?>
+            </ul>       
+
+                       <br/>
+
+        <?php else: ?>
+       
+       <div class="func"><a href="/code/?inline=1">inline</a></div>    
+
+            <table class="archive" cellspacing="0" cellpadding="0">
+
+                <tr>
+                    <td><a class="func" href="?order=lang">language</a></td>
+                    <td><a class="func" href="?order=name">name</a></td>
+                </tr>
+
+                <?php
+                $c = 1; 
+                foreach($items_list as $items): ?>
+                       <tr>
+                    <td style="padding-right:1em;">
+                        <strong class="medium"><?php echo $items['medium']; ?></strong>
+                    </td>
+                    <td>
+                        <strong>
+                                   <a onmouseout="$('.c_pop').hide();" onmouseover="$('.c_pop').hide(); $('#c_<?php echo $c; ?>').show();" href="<?php echo $items['href']?>"><?php echo $items['title']; ?></a>
+                        </strong>
+                        <div id="c_<?php echo $c; ?>" class="c_pop">
+                        <?php 
+                            $base_dir = $items['base_dir'];
+                            include( $items['content'] ); 
+                        ?>
+                        </div>
+                    </td>
+                    </tr>
+                <? $c++;  endforeach; ?>
+            </table>          
+            
+        <?php endif; ?>
+        
+    </div>
+    
+</body>
+
+</html>
\ No newline at end of file
diff --git a/templates/code.html.tpl b/templates/code.html.tpl
new file mode 100644 (file)
index 0000000..2502d79
--- /dev/null
@@ -0,0 +1,118 @@
+<?php
+
+
+    $items = array();
+    $single = false;
+    
+    if (is_dir(CONTENT_DIR . $url_string) && !is_file(CONTENT_DIR . $url_string . '/config') ) {
+               list($items, $total) = get_inline_entries(array('code'));       
+    //    list($items_list, $total) = get_content(basename($url_string));
+    }
+    else {
+               list($items, $total) = get_inline_entries(array('code'), array('name'=>basename($url_string)));         
+               $items = $items[0];
+        $single = true;
+    }
+
+       $inline = isset($_GET['inline']) ? true : false;
+       
+       $page = "code";
+
+
+?>
+<html>
+
+<head>
+    <?php include_template('header-src.html'); ?>
+    <script src="/js/jquery-1.3.2.min.js"></script>
+    
+    <title><?php echo SITE_TITLE; ?> - code<?php if (sizeof($items) > 0 ) : ?>: <?echo strtolower($items['title']); ?> [<?php echo $items['medium']; ?>]<?php endif; ?></title>
+        
+</head>
+
+<body>
+    
+    <?php 
+        include('nav.html');         
+    ?>
+
+    <div id="content">
+       
+        <?php if ($single) : ?>
+
+                       <h2><?=$items['title']?> [<?=$items['date']?>]</h2>
+
+            <div class="content">
+                <?php 
+                    print ($items['content']);
+                ?>
+            </div>
+       
+        <?php elseif ($inline): ?>
+       
+<div class="func"><a href="/code/">list</a></div>              
+       
+            <ul class="inline_content">
+            <?php foreach($items_list as $items): ?>
+                   <li>
+                       <h3>
+                           <a href="<?php echo $items['href']?>"><?php echo $items['title']; ?></a>
+                    </h3>
+                    <div class="content">
+                    <?php 
+                        $base_dir = $items['base_dir'];
+                        include( $items['content'] ); 
+                    ?>
+                    </div>
+                </li>
+            <?  endforeach; ?>
+            </ul>       
+
+                       <br/>
+
+        <?php else: ?>
+       
+<!--   <div class="func"><a href="/code/?inline=1">inline</a></div>    -->
+
+        <h2>code</h2>
+
+            <table class="archive" cellspacing="0" cellpadding="0">
+
+                <tr>
+                    <td><a class="func" href="?order=lang">language</a></td>
+                    <td><a class="func" href="?order=name">name</a></td>
+                </tr>
+
+                <?php
+                $c = 1; 
+                foreach($items as $item): 
+                               
+//                             print_r($item);
+
+?>
+
+
+                       <tr>
+                    <td style="padding-right:1em;">
+                        <strong class="medium"><?php echo $item['lang']; ?></strong>
+                    </td>
+                    <td>
+                                   <a onmouseout="$('.c_pop').hide();" onmouseover="$('.c_pop').hide(); $('#c_<?php echo $c; ?>').show();" href="<?php echo $item['url']?>"><?php echo $item['title']; ?></a>
+                        <div id="c_<?php echo $c; ?>" class="c_pop">
+                        <?php 
+                            $base_dir = $items['base_dir'];
+                                                       echo $item['content'] ; 
+                        ?>
+                        </div>
+                    </td>
+                    </tr>
+                <? $c++;  endforeach; ?>
+            </table>          
+            
+        <?php endif; ?>
+        
+    </div>
+    
+</body>
+
+</html>
\ No newline at end of file
diff --git a/templates/entry.html.tpl b/templates/entry.html.tpl
new file mode 100644 (file)
index 0000000..d60ee65
--- /dev/null
@@ -0,0 +1,13 @@
+
+<div class="entry">
+       
+       <h2>
+               <a title="posted on <?=$entry['date']?>" href="<?=$entry['url']?>"><?=$entry['title']?></a>
+       </h2>
+       
+       <div class="content">
+               
+       <?=$entry['content']?>
+       
+       </div>
+</div>
diff --git a/templates/footer.html.tpl b/templates/footer.html.tpl
new file mode 100644 (file)
index 0000000..bb41cff
--- /dev/null
@@ -0,0 +1,14 @@
+<script type="text/javascript">
+
+  var _gaq = _gaq || [];
+  _gaq.push(['_setAccount', 'UA-351774-1']);
+  _gaq.push(['_setDomainName', '.quilime.com']);
+  _gaq.push(['_trackPageview']);
+
+  (function() {
+    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
+    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
+    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
+  })();
+
+</script>
\ No newline at end of file
diff --git a/templates/head-inc.html.tpl b/templates/head-inc.html.tpl
new file mode 100644 (file)
index 0000000..5904973
--- /dev/null
@@ -0,0 +1,23 @@
+
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8">    
+<meta name="google-site-verification" content="1OBSuW_Qc3OFWC8whRGv2DJxQUUZkjcaY_cdd6PpdR8" />
+
+<script type="text/javascript" src="<?= get_base_dir(); ?>/js/jquery-1.3.2.min.js"></script>
+<!-- code prettifyier -->
+<link href="<?= get_base_dir(); ?>/js/prettify/prettify.css" type="text/css" rel="stylesheet" />
+<script type="text/javascript" src="<?= get_base_dir(); ?>/js/prettify/prettify.js"></script>
+
+<link rel="stylesheet" href="<?= get_base_dir(); ?>/css/style.css" type="text/css">
+
+
+<script>
+
+ $(document).ready(function() {
+     prettyPrint();
+ });
+
+ $(document).mousemove(function(e){
+    $('.c_pop').css({'left':(e.pageX-170)+"px", 'top':e.pageY+"px"});
+ }); 
+
+</script>
\ No newline at end of file
diff --git a/templates/index.html.tpl b/templates/index.html.tpl
new file mode 100644 (file)
index 0000000..0342c64
--- /dev/null
@@ -0,0 +1,24 @@
+<html>
+<head>
+    
+    <? $this->include_template('head-inc.html.tpl') ?>
+    
+    <title><?=SITE_TITLE?></title>
+    
+</head>
+<body>
+    
+    <? $this->include_template('nav.html') ?>
+    
+<div id="content">
+
+       <? foreach($entries as $entry): ?>
+       <? $this->include_template('entry.html.tpl', array('entry' => $entry)); ?>
+       <? endforeach; ?>
+       
+</div>
+
+       <? $this->include_template('footer.html.tpl') ?>
+
+</body>
+</html>
diff --git a/templates/index.json.tpl b/templates/index.json.tpl
new file mode 100644 (file)
index 0000000..712719b
--- /dev/null
@@ -0,0 +1,5 @@
+{
+    "entries": <? print json_encode($entries); ?>,
+    "count": <?=$total?>, 
+    "total": <?=$total?>
+}
similarity index 95%
rename from templates/links.html
rename to templates/links.html.tpl
index 55a769d9083df78d39995444b8d764c97030971f..ef7e0dd69a9597340898870fe3190d20fdd21af7 100644 (file)
@@ -25,7 +25,7 @@
             function linklist($links)
             { ?>
                 <?php foreach($links as $l) : ?>
-                <li><a href="http://<?php echo $l[0];?>"><?php echo $l[0];?></a></li>
+                <li><a href="http://<?php echo $l[0];?>"><?php echo $l[1];?></a></li>
                 <?php endforeach; ?>
             <?php
             }
@@ -38,6 +38,7 @@
                     array('oddsympathy.com', 'daniel massey'),
                     array('jtnimoy.net', 'joshua nimoy'),
                     array('keithpasko.com', 'keith pasko'),
+                                       array('carbonworkshop.com', 'carbon workshop'),
                     array('pohflepp.com', 'sascha pohflepp'),
                     array('mylinhtrieu.com', 'mylinh trieu'),
                     array('universaloscillation.com', 'aaron meyers'),
similarity index 64%
rename from templates/log.html
rename to templates/log.html.tpl
index 491c805a8e0880babb8795b6bf87ebc3dc8c1ee1..aea4be93009e42e87110c63c93d47ffbc6e4afcd 100644 (file)
@@ -1,9 +1,11 @@
 <?php
-
+/*
+    $items = array();
     $single = false;
     
     if (is_dir(CONTENT_DIR . $url_string) && !is_file(CONTENT_DIR . $url_string . '/config') ) {
-        list($log_list, $total) = get_content(basename($url_string), "type=flat");
+        list($items, $total) = get_inline_entries(array('log'));
+        //list($log_list, $total) = get_content(basename($url_string), "type=flat");
     }
     else {
         $config = parse_config(CONTENT_DIR . $url_string);
     $list = isset($_GET['list']) ? $_GET['list'] : false;
 
        $page = "/log";
-    
+*/
 ?>
 <html>
 
 <head>
 
-    <?php include_template('header-src.html'); ?>
+    <? $this->include_template('head-inc.html.tpl') ?>
         
     <title>
-        <?php echo SITE_TITLE; ?><?php if ($single) : ?> - log: <?echo strtolower($log['title']); ?> [<?php echo date("Y M d", strtotime($log['date']));?>]<? else: ?> - log<? endif; ?></title>
-
-    <script src="/js/jquery-1.3.2.min.js"></script>
+        <?=SITE_TITLE; ?>
+        <? if ($single): ?> 
+                       - log: <?= $entry['title']; ?> 
+                       [<?=date("Y M d", strtotime($entry['date']));?>]
+               <? else: ?>
+                       - log
+               <? endif; ?>
+       </title>
 
 </head>
 
     
     <?php include('nav.html'); ?>
 
-
-
     <div id="content">
 
         <?php if ($single) : ?>
 
-               <h1>
-                   <a title="posted <?php echo get_relative_time($log['timestamp']); ?>" href="<?php echo $log['href'];?>">
-                       <?php echo $log['title']; ?>
-                               </a><small>[<?php echo date("Y M d", strtotime($log['date']));?>]</small>
-               </h1>
+               <h2>
+                   <a title="posted <?php echo get_relative_time($item['timestamp']); ?>" href="<?php echo $item['url'];?>">
+                       <?php echo $item['title']; ?>
+                               </a><small>[<?php echo date("Y M d", strtotime($item['date']));?>]</small>
+               </h2>
        
                        
        
             <div class="content">
-            <?php echo $log['inline_content']; ?>
+            <?=$item['inline_content'];?>
             </div>
                                 
-        <?php elseif ($list): ?>
+        <?php elseif ($view == 'archive'): ?>
         
            <table class="archive" cellspacing="0" cellpadding="0">
                 <tr>
@@ -63,7 +68,7 @@
                 </td>
                 <?php 
                     $c = 1; 
-                    foreach($log_list as $log): 
+                    foreach($items as $log): 
                 ?>
                 <tr>
                 <td style="text-align:right; padding-right:1em;">
                                    <a onmouseout="$('.c_pop').hide();" onmouseover="$('.c_pop').hide(); $('#c_<?php echo $c; ?>').show();" href="<?php echo $log['href']?>"><?php echo $log['title']; ?></a>
                                </strong>
                     <div id="c_<?php echo $c; ?>" class="c_pop">
-                    <?php 
-                        $base_dir = $log['base_dir'];
-                        echo $log['inline_content']; 
-                        ?>
+                    <?=$log['content']; ?>
                     </div>
                 </td>
                 </tr>
         <?php else: ?>
        
             <ul class="inline_content log">
-            <?php foreach($log_list as $log): ?>
+            <?php foreach($items as $log): ?>
                    <li>
                        <h3>
                                
-                           <a title="<?php echo get_relative_time($log['timestamp']); ?>" href="<?php echo $log['href'];?>">
+                           <a title="<?php echo get_relative_time($log['timestamp']); ?>" href="<?php echo $log['url'];?>">
                                <?php echo $log['title']; ?></a>   
-                       </h3>                    
-                    <?php echo $log['inline_content']; ?>
+                       </h3>      
+                    <div class="content">              
+                    <?php echo $log['content']; ?>
+                    </div>
                 </li>
             <? endforeach; ?>
             </ul>
             
             <br/>            
-            <a class="func" href="/log/?list=1">view archive</a>
+            <a class="func" href="/log/?v=archive">view archive</a>
            
             
         <?php endif; ?>
index 57688baede8c2097c2edd9f3704028e420d39a8a..3bb026a1b99f924ee611edd50005d7ab7af72563 100644 (file)
@@ -1,8 +1,10 @@
 <ul class="nav">          
        <li><a href="/">home</a><br/><br/></li>
-    <li><a href="/about/">about</a></li>
-    <li><a href="/log/">log</a></li>
+       <li><a href="/log/">log</a></li>                
+       <li><a href="/code/">code</a><br/><br/></li>
+       
+       
     <li><a href="/agg/">aggregate</a></li>
-    <li><a href="/code/">code</a></li>
     <li><a href="/links/">links</a></li>
+    <li><a href="/about/">about</a></li>
 </ul>