]> git.quilime.com - plog_bk.git/commitdiff
making template.php work
authorGabriel Dunne <gdunne@quilime.com>
Sat, 29 May 2010 05:02:28 +0000 (22:02 -0700)
committerGabriel Dunne <gdunne@quilime.com>
Sat, 29 May 2010 05:02:28 +0000 (22:02 -0700)
.htaccess
README
index.php
plog/lib/config
plog/lib/init.php
plog/lib/output.php
plog/lib/template.php [new file with mode: 0644]

index bef083f540a74d269188095e2a041b7c131d9b37..7ca81dd4ecbee8baafaef3e50e9118fa3f0db844 100644 (file)
--- a/.htaccess
+++ b/.htaccess
@@ -1,9 +1,8 @@
 
-
 <IfModule mod_rewrite.c>
-RewriteEngine On
-RewriteBase /
-RewriteCond %{REQUEST_FILENAME} !-f
-#RewriteCond %{REQUEST_FILENAME} !-d
-RewriteRule . index.php [L]
+       RewriteEngine On
+       RewriteBase /
+       RewriteCond %{REQUEST_FILENAME} !-f
+       #RewriteCond %{REQUEST_FILENAME} !-d
+       RewriteRule . index.php [L]
 </IfModule>
diff --git a/README b/README
index b11749f3e53ad564b774938625eeef4b9f55a055..39c413ba24fd7391fed24116224e7604c3b32606 100644 (file)
--- a/README
+++ b/README
@@ -2,18 +2,19 @@ plog
 CMS
 
 filesystem: /
-    .htaccess
-    index.php
-      large redirect
-   plog/
-    config
-    lib/
-       Smarty/
-    templates/
-           default/
-              style.css
-              .. other template files
-       
+       .htaccess
+       index.php
+               large redirect
+       content/
+               .. content
+       plog/
+               config
+               lib/
+               Smarty/
+               templates/
+                       default/
+                       style.css
+                       .. other template files
 
 + cache in sqlite db for searching, tags, etc
 + auto generate thumbnails
index c827ad908e23c79fb5312ee0625ed6d4efe7fb6c..a9be48aae4138702ba2c0569403984155c882e48 100644 (file)
--- a/index.php
+++ b/index.php
@@ -1,7 +1,5 @@
 <?php
 
-    require_once "plog/lib/init.php";
-        
-    include ( get_template_dir() . 'index.' . get_format() );
+    require_once "./plog/lib/init.php";
 
 ?>
index 502caa60972ca5ac54c140df5f1eab552294216d..0178c6fc5c7225444b293cc8cadcd10c218e4be4 100644 (file)
@@ -1,3 +1,4 @@
+PLOG_DIR               = /home/quilime/py.quilime.com/
 LOCAL_ROOT      = /home/quilime/quilime.com/
 CONTENT_DIR     = c/
 TEMPLATE_DIR    = plog/templates/
index b7599d4f8cbe6de744532d26279504ad9dc7b98a..3dfaa6819ea326d441315547de255e0948396405 100644 (file)
@@ -1,10 +1,68 @@
-<?php 
-    
-    ini_set('include_path', ini_get('include_path') . PATH_SEPARATOR . LOCAL_ROOT . '/lib/');
-    
-    require_once 'data.php';
-    require_once 'output.php';
-    
-    define_constants();
-    
+<?php
+
+       define('PLOG_ROOT', $_SERVER['DOCUMENT_ROOT'] . '/plog');
+       define('WEBROOT', 'http://' . $_SERVER['SERVER_NAME']);
+       define('TEMPLATE_DIR', dirname(realpath(__FILE__)) . '/../templates');  
+       define('CONTENT_ROOT', $_SERVER['DOCUMENT_ROOT'] . '/content');
+       define('CONTENT_BASEDIR', $_SERVER['DOCUMENT_ROOT'] . '/content' . $_SERVER['SCRIPT_URL']);
+       define('CONTENT_WEBROOT', 'http://' . $_SERVER['SERVER_NAME'] . '/content' . $_SERVER['SCRIPT_URL']);
+       define('CONTENT_SRC', CONTENT_BASEDIR . 'content.php');
+       
+       define('CONFIG', 'config');
+
+    ini_set('include_path', ini_get('include_path') . PATH_SEPARATOR . dirname(realpath(__FILE__)));
+       require_once 'output.php';
+       require_once 'template.php';
+
+       # response format
+       list($response_format, $response_mime_type) = parse_format($_GET['format'], 'html');
+
+       # template
+       $template = new Template();
+
+       # parse content dir
+       if (is_dir(CONTENT_BASEDIR)) {
+
+               # config
+               if (is_file(CONTENT_BASEDIR . CONFIG))
+                       $config = parse_ini_file(CONTENT_BASEDIR . CONFIG);
+
+               # template
+               if ($config['template'])
+                       $template->set_src(TEMPLATE_DIR . '/' . $config['template'] . '.' . $response_format . '.tpl');
+               else if (file_exists(CONTENT_SRC))
+                       $template->set_src(CONTENT_SRC);
+                       
+//             echo $template->src;    
+               
+               # content
+               # images
+               $images = array();
+               foreach(glob(CONTENT_BASEDIR . "{*.jpg,*.gif,*.png}", GLOB_BRACE) as $img) {
+                       $i = array();
+                       $i['name'] = basename($img);
+                       $i['url'] = str_replace(CONTENT_BASEDIR, CONTENT_WEBROOT, $img);
+                       $images[] = $i;
+               }
+       }
+
+       # header
+//     header("Content-Type: {$response_mime_type}; charset=UTF-8");
+//     $template->render();
+
+
+
+// print_r($_SERVER);
+
+//     $images = glob("images/{*.jpg,*.gif,*.png}", GLOB_BRACE);
+//     print_r($images);
+
+
+
+
+//    require_once 'data.php';
+//    require_once 'output.php';
+
+//    define_constants();
+
 ?>
\ No newline at end of file
index 14a8673a4b05cdb16235d00081167743e143529d..7f1c2fe7f479eea27daf78ac1ec402a72ceab7fe 100644 (file)
@@ -1,6 +1,5 @@
 <?php
 
-
    /**
     * @param    string  $format     "text", "xml", etc.
     * @param    string  $default    Default format
diff --git a/plog/lib/template.php b/plog/lib/template.php
new file mode 100644 (file)
index 0000000..e709477
--- /dev/null
@@ -0,0 +1,20 @@
+<?php
+
+       class Template
+       {
+               var $src;
+               
+               function set_src( $template_src )
+               {
+                       echo "this is a test";
+                       $this->src = $template_src;
+               }
+               
+               function render()
+               {
+                       echo "test";
+                       echo $this->src;
+               }
+       }
+
+?>
\ No newline at end of file