added a permalink and use clean urls
authorArun Persaud <arun@nubati.net>
Fri, 25 Nov 2011 04:41:53 +0000 (20:41 -0800)
committerArun Persaud <apersaud@lbl.gov>
Fri, 25 Nov 2011 04:41:53 +0000 (20:41 -0800)
this needs .htaccess. Already added clean urls for tags and single pic, but at the moment only page is working.

.htaccess_template [new file with mode: 0644]
README
index.php
style.css

diff --git a/.htaccess_template b/.htaccess_template
new file mode 100644 (file)
index 0000000..203ba4c
--- /dev/null
@@ -0,0 +1,24 @@
+<IfModule mod_rewrite.c>
+RewriteEngine on
+
+RewriteBase   /<insert web base url here>
+
+
+# make the url nice and clean; the comments shows an url that should be matched
+
+# web_base/tag/me+berlin/pic/id 
+RewriteRule tag/([-_a-zA-Z0-9+]*)/pic/([0-9]*) index.php?tag=$1&pic=$2 [L]
+
+# web_base/tag/tag1+tag2/page/4 
+RewriteRule tag/([-_a-zA-Z0-9+]*)/page/([0-9]*) index.php?tag=$1&page=$2 [L]
+
+# web_base/tag/tag1+tag2
+RewriteRule tag/([-_a-zA-Z0-9+]*) index.php?tag=$1 [L]
+
+# web_base/pic/17
+RewriteRule pic/([0-9]*) index.php?pic=$1 [L]
+
+# web_base/page/4  
+RewriteRule page/([0-9]*) index.php?page=$1 [L]
+
+</IfModule>
diff --git a/README b/README
index cfbf5411839658e31e0a3dc93f0263f93ab0ef5b..146cd7183a3275da055b362825ce2a3e65b62ce4 100644 (file)
--- a/README
+++ b/README
@@ -1,7 +1,8 @@
 This are some simple php files and bash scripts to display your F-spot
 This are some simple php files and bash scripts to display your F-spot
-photos including information from the data-base on a webpage.
+photos including information from the data-base on a webpage. To get
+up and running follow these steps:
 
 
-You can exclude/include certain tags incase you want for example on
+1) You can exclude/include certain tags incase you want for example on
 show pictures on the web that were tagged "Public".
 
 To use the scripts copy config.ini_template to config.ini, edit it and
 show pictures on the web that were tagged "Public".
 
 To use the scripts copy config.ini_template to config.ini, edit it and
@@ -10,7 +11,9 @@ then run for example
 f-spot-db-reduce.sh --include='Public'
 
 This will create a new smaller database that only contains information
 f-spot-db-reduce.sh --include='Public'
 
 This will create a new smaller database that only contains information
-about pictures with the Public tag.  Next run
+about pictures with the Public tag. 
+
+2)  Next run
 
 ./create_thumbnails.sh
 
 
 ./create_thumbnails.sh
 
@@ -20,7 +23,10 @@ will need to run it several times. This is done, so that you limit the
 time this tasks run, so that it doesn't get shut down on for example
 rented web-space where execcive CPU uses is an issue.
 
 time this tasks run, so that it doesn't get shut down on for example
 rented web-space where execcive CPU uses is an issue.
 
-Ones this is done you can visit index.php and everything should be working.
+3) install .htaccess
+
+edit the "RewriteBase" in the .htaccess_template file and rename it to .htaccess.
+Onces this is done you can visit index.php and everything should be working.
 
 Feel free to fork, send in patches, make suggestions.
 
 
 Feel free to fork, send in patches, make suggestions.
 
index 44be53b253318db28df504c1a123749b642537f0..5f045433d197bff0dca0c7a0c4ca2803b9605271 100644 (file)
--- a/index.php
+++ b/index.php
@@ -17,9 +17,9 @@ else
 ?>
 <html>
 <title><?php echo htmlspecialchars($title) ?></title>
 ?>
 <html>
 <title><?php echo htmlspecialchars($title) ?></title>
-<script src="d3.min.js"></script>
-<link rel="stylesheet" type="text/css" href="normalize.css" />
-<link rel="stylesheet" type="text/css" href="style.css" />
+<script src="<?php echo $webbase?>/d3.min.js"></script>
+<link rel="stylesheet" type="text/css" href="<?php echo $webbase?>/normalize.css" />
+<link rel="stylesheet" type="text/css" href="<?php echo $webbase?>/style.css" />
 
 <body>
 
 
 <body>
 
@@ -29,6 +29,8 @@ else
 <button class="prev" disabled="disabled" onclick="left()"> prev </button>
 <button class="next"   onclick="right()">next </button>
 
 <button class="prev" disabled="disabled" onclick="left()"> prev </button>
 <button class="next"   onclick="right()">next </button>
 
+<div class="permalink"></div>
+
 <div class="pics"> </div>
 
 <footer>
 <div class="pics"> </div>
 
 <footer>
@@ -68,6 +70,8 @@ function myreload(a) {
       checkbutton();
     });
 
       checkbutton();
     });
 
+  permalink="<?php echo $webbase ?>/page/"+page;
+  d3.select(".permalink").html("Permalink: <a href=\""+permalink+"\">"+permalink+"</a>");
   d3.select(".debug").text("P, count= "+a+" "+count);
 }
 
   d3.select(".debug").text("P, count= "+a+" "+count);
 }
 
index 021c204a70cbd30ae0a88c0ac1886f6bae3af45d..b394c6c5649ffd7b43c4910aa14755f2a56ded84 100644 (file)
--- a/style.css
+++ b/style.css
@@ -2,6 +2,14 @@
 h1 {color:red}
 body {background-color: black}
 
 h1 {color:red}
 body {background-color: black}
 
+.permalink {
+    float:right;
+    color: #eee;
+    padding-right: 1em;
+}
+
+a[visited]{ color: #aaa;}
+
 .pics li { 
   display: inline;
   list-style: none;
 .pics li { 
   display: inline;
   list-style: none;