DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:bliki

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
plugin:bliki [2011-06-18 15:57] – changed external links to dokuwiki.org to internal links achplugin:bliki [2018-05-12 17:38] – downloadurl Aleksandr
Line 6: Line 6:
 email      : beau@dentedreality.com.au email      : beau@dentedreality.com.au
 type       : syntax type       : syntax
-lastupdate : 2005-10-16 +lastupdate : 2011-10-31 
-compatible : +compatible : 2011-05-25 "Rincewind", "Angua"
 depends    :  depends    : 
 conflicts  conflicts 
-similar    : blog +similar    : blog, blogtng, log 
-tags       : blog, news +tags       : blog, news, twitter
-----+
  
 +downloadurl: https://trello-attachments.s3.amazonaws.com/5af4815352fa15728c62aaae/5af70a06baeeb1371277812c/419e148e75b38030078c3ae0d7862f0a/bliki.zip
 +bugtracker :
 +sourcerepo :
 +donationurl:
  
-by [[beau@dentedreality.com.au|Beau Lebens]] and [[anthony.caetano@sanlam.co.za|Anthony Caetano]]+screenshot_img: 
 +---- 
 + 
 +By [[beau@dentedreality.com.au|Beau Lebens]] and [[anthony.caetano@sanlam.co.za|Anthony Caetano]].
  
 ===== Description ===== ===== Description =====
 +
 Bliki allows you to create a simple blog on any page of your wiki by adding a single tag (''%%~~BLIKI~~%%'') to your page. It uses date-based namespaces to store your entries, and automatically handles paging of posts, a 'new post' link, date headers and post footers. Bliki allows you to create a simple blog on any page of your wiki by adding a single tag (''%%~~BLIKI~~%%'') to your page. It uses date-based namespaces to store your entries, and automatically handles paging of posts, a 'new post' link, date headers and post footers.
  
 ===== Version/Requirements ===== ===== Version/Requirements =====
 +
 Latest version released 2005-10-16 and developed/tested using the 2005-07-13 version of DokuWiki. Latest version released 2005-10-16 and developed/tested using the 2005-07-13 version of DokuWiki.
 +
 +**Update**: thanks to [[user>Taggic]], bliki now works with Rincewind and Angua.
  
 ==== Previous Versions ==== ==== Previous Versions ====
 +
   * First release: deep storage only.   * First release: deep storage only.
  
Line 29: Line 40:
  
 ==== Plugin Source ==== ==== Plugin Source ====
 +
 Create a directory called ''bliki'' inside your ''lib/plugins/'' directory, and then copy the following source into ''syntax.php'' in that directory (''lib/plugins/bliki/syntax.php''). Obviously make sure the file is readable by your webserver. Create a directory called ''bliki'' inside your ''lib/plugins/'' directory, and then copy the following source into ''syntax.php'' in that directory (''lib/plugins/bliki/syntax.php''). Obviously make sure the file is readable by your webserver.
  
-<code php>+---- 
 + 
 +2011-10-31 [[user>Taggic]] -> tested following on 2011-05-25a “Rincewind” 
 + 
 + 
 +<file php syntax.php>
 <?php <?php
 /** /**
Line 39: Line 56:
  * @author     Beau Lebens <beau@dentedreality.com.au>  * @author     Beau Lebens <beau@dentedreality.com.au>
  * @author Anthony Caetano <Anthony.Caetano@Sanlam.co.za>  * @author Anthony Caetano <Anthony.Caetano@Sanlam.co.za>
- + 2011-10-31  modified by Taggic to get is work with current dokuwiki (Rincewind)
  */  */
    
Line 127: Line 144:
  // Only do it if the namespace exists  // Only do it if the namespace exists
  if (is_dir($ID . '/')) {  if (is_dir($ID . '/')) {
- if ($conf['bliki']['structure'== 'flat') {+ if ($this->getConf('structure'== 'flat') {
  $posts = $this->read_dir_to_array($ID . '/', 'file', '/^[0-9]{4}-[0-9]{2}-[0-9]{2}-[0-9]{6}\.txt$/');  $posts = $this->read_dir_to_array($ID . '/', 'file', '/^[0-9]{4}-[0-9]{2}-[0-9]{2}-[0-9]{6}\.txt$/');
  sort($posts);  sort($posts);
Line 141: Line 158:
  return $recents;  return $recents;
  }  }
- else {   // $conf['bliki']['structure'== 'deep'+ else {   // $this->getConf('structure'== 'deep'
  $years = $this->read_dir_to_array($ID . '/', 'dir');  $years = $this->read_dir_to_array($ID . '/', 'dir');
  sort($years);  sort($years);
Line 209: Line 226:
        $edit_url = $this->getRewriteUrl($post_url, 'do=edit', false);        $edit_url = $this->getRewriteUrl($post_url, 'do=edit', false);
         
-    $timestamp = date($conf['bliki']['datefooter'], $ts); +    $timestamp = date($this->getConf('datefooter'), $ts); 
-    $str .= str_replace(array('{timestamp}', '{permalink}', '{edit}'), array($timestamp, $post_url, "this>$edit_url"), $conf['bliki']['footer']);+    $str .= str_replace(array('{timestamp}', '{permalink}', '{edit}'), array($timestamp, $post_url, "this>$edit_url"), $this->getConf('footer'));
     }     }
     return $str;     return $str;
Line 227: Line 244:
     global $conf;     global $conf;
         
-    $date = date($conf['bliki']['dateheader'], $ts);+    $date = date($this->getConf('dateheader'), $ts);
     return $date . "\n";     return $date . "\n";
     }     }
Line 239: Line 256:
  global $conf;  global $conf;
         
- if ($conf['bliki']['structure'== 'flat') {+ if ($this->getConf('structure'== 'flat') {
  $parts = explode('-', basename($file));  $parts = explode('-', basename($file));
  $ts = mktime(substr($parts[3], 0, 2), substr($parts[3], 2, 2), substr($parts[3], 4, 2), $parts[1], $parts[2], $parts[0]);  $ts = mktime(substr($parts[3], 0, 2), substr($parts[3], 2, 2), substr($parts[3], 4, 2), $parts[1], $parts[2], $parts[0]);
  
- else {  // $conf['bliki']['structure'== 'deep'+ else {  // $this->getConf('structure'== 'deep'
  $parts = explode('/', dirname($file));  $parts = explode('/', dirname($file));
  $s = sizeof($parts);  $s = sizeof($parts);
Line 266: Line 283:
       }       }
  
-      if ($conf['userewrite'] > 0) {+/*      if ($conf['userewrite'] > 0) {
       $sep = ($conf['useslash'] == true ? '/' : ':');       $sep = ($conf['useslash'] == true ? '/' : ':');
       }        } 
-      else {+      else {      */
           $sep = ':';           $sep = ':';
-      }+//      }
  
-      if ($conf['bliki']['structure'== 'flat') {+      if ($this->getConf('structure'== 'flat') {
           return $ID . $sep . date('Y-m-d-His', $ts);           return $ID . $sep . date('Y-m-d-His', $ts);
       }        } 
-      else { // $conf['bliki']['structure'== 'deep'+      else { // $this->getConf('structure'== 'deep'
   return $ID . $sep . date('Y' . $sep . 'm' . $sep . 'd' . $sep . 'His', $ts);   return $ID . $sep . date('Y' . $sep . 'm' . $sep . 'd' . $sep . 'His', $ts);
       }       }
Line 330: Line 347:
     global $conf, $ID;     global $conf, $ID;
         
-    $sep = ($conf['useslash'] == true ? '/' : ':'); +//    $sep = ($conf['useslash'] == true ? '/' : ':'); 
-     $html = '<div id="blognew"><a href="'; +      $sep = ':'; 
-   $html .= $this->getRewriteUrl($this->getUrlPartFromTimestamp($ID, time() + (isset($conf['bliki']['offset']) ? ($conf['bliki']['offset'* 3600) : 0)), 'do=edit'); +                                                      //+ (isset($this->getConf('offset')) ? ($this->getConf('offset'* 3600) : 0) 
- $html .= '">' . $label . '</a></div>';+      $page = $this->getUrlPartFromTimestamp($ID, time());       
 +    $html = '<div id="blognew">'; 
 +    $hilf = $this->getRewriteUrl($page, 'do=edit'); 
 +      $output '<a href="'.$hilf.'">' . $label . '</a>'; 
 +   $html .= $output.'</div>';
   
  return $html;  return $html;
Line 418: Line 439:
  if ($mode == 'xhtml') {  if ($mode == 'xhtml') {
  // Addlink for creating a new post  // Addlink for creating a new post
- $renderer->doc .= $this->newPostLink($conf['bliki']['newlabel']);+ $renderer->doc .= $this->newPostLink($this->getConf('newlabel'));
  
  // Go and get the required blog posts and compile them into one wikitext string  // Go and get the required blog posts and compile them into one wikitext string
  // FIXME $config var for how many? or inline directive?  // FIXME $config var for how many? or inline directive?
- $recents = $this->getPosts($ID, $conf['bliki']['numposts'], ($page * $conf['bliki']['numposts']));+ $recents = $this->getPosts($ID, $this->getConf('numposts'), ($page * $this->getConf('numposts')));
  $compiled = $this->compilePosts($recents);  $compiled = $this->compilePosts($recents);
   
Line 435: Line 456:
  
  // Add a link to older entries if we filled the number per page (assuming there's more)  // Add a link to older entries if we filled the number per page (assuming there's more)
- if (sizeof($recents) == $conf['bliki']['numposts']) { + if (sizeof($recents) == $this->getConf('numposts')) { 
- $renderer->doc .= '<div id="blogolder">' . $this->pagingLink($page+1, $conf['bliki']['olderlabel']) . '</div>';+ $renderer->doc .= '<div id="blogolder">' . $this->pagingLink($page+1, $this->getConf('olderlabel')) . '</div>';
  }  }
  
  // And also a link to newer posts if we're not on page 0  // And also a link to newer posts if we're not on page 0
  if ($page != 0) {  if ($page != 0) {
- $renderer->doc .= '<div id="blognewer">' . $this->pagingLink($page-1, $conf['bliki']['newerlabel']) . '</div>';+ $renderer->doc .= '<div id="blognewer">' . $this->pagingLink($page-1, $this->getConf('newerlabel')) . '</div>';
  }  }
  
Line 449: Line 470:
  }  }
 } }
- 
 ?> ?>
-</code>+</file>
  
 ==== Conf Changes ==== ==== Conf Changes ====
Line 458: Line 478:
 ^ Please note the new ''structure'' and ''offset'' options! ^ ^ Please note the new ''structure'' and ''offset'' options! ^
  
-<code php> +<file php local.php> 
-$conf['bliki']['structure'] = 'flat'; // Structure to use when storing posts; [flat | deep] +<?php 
-$conf['bliki']['offset'] = 0; // Number of hours to offset new post times from your server (eg -3 if you post from a timezone 3 hours behind your server) +// * 2011-10-31  modified by Taggic to get is work with current dokuwiki (Rincewind) 
-$conf['bliki']['numposts'] = 15; // Number of posts to show on each page of a blog +$conf['plugin']['bliki']['structure'] = 'flat'; // Structure to use when storing posts; [flat | deep] 
-$conf['bliki']['dateheader'] = '===== l, F j ====='; // Format for date header/separator (passed to date(), escape special flags!) +$conf['plugin']['bliki']['offset'] = 0; // Number of hours to offset new post times from your server (eg -3 if you post from a timezone 3 hours behind your server) 
-$conf['bliki']['datefooter'] = 'n/j/Y g:ia'; // Format for the footer datestamp (includes hours/minutes) (passed to date(), escape special flags!) +$conf['plugin']['bliki']['numposts'] = 15; // Number of posts to show on each page of a blog 
-$conf['bliki']['footer'] = "\n\n><sub>Posted @ {timestamp} -- [[{permalink}|Permalink]] -- [[{edit}|Edit]]</sub>\n\\\\\\\\\n"; // use {timestamp}, {permalink} and {edit} to link to special variables. +$conf['plugin']['bliki']['dateheader'] = '===== l, F j ====='; // Format for date header/separator (passed to date(), escape special flags!) 
-$conf['bliki']['newlabel'] = '&raquo; New Post'; // Label for the new post button/link +$conf['plugin']['bliki']['datefooter'] = 'n/j/Y g:ia'; // Format for the footer datestamp (includes hours/minutes) (passed to date(), escape special flags!) 
-$conf['bliki']['olderlabel'] = 'Older Posts &raquo;'; // Link to older posts +$conf['plugin']['bliki']['footer'] = ' \\\\ <sub>Posted @ {timestamp} -- [[{permalink}|Permalink]] -- [[{edit}|Edit]]</sub> \\\\ \\\\ '; // use {timestamp}, {permalink} and {edit} to link to special variables. 
-$conf['bliki']['newerlabel'] = '&laquo; Newer Posts'; // Link to newer posts +$conf['plugin']['bliki']['newlabel'] = '&raquo; New Post'; // Label for the new post button/link 
-</code>+$conf['plugin']['bliki']['olderlabel'] = 'Older Posts &raquo;'; // Link to older posts 
 +$conf['plugin']['bliki']['newerlabel'] = '&laquo; Newer Posts'; // Link to newer posts 
 +</file>
  
 The values used here are a good starting point, but you can customize them from there. The values used here are a good starting point, but you can customize them from there.
Line 475: Line 497:
 Bliki adds some additional elements to your page when you use it, so you have the ability to style those elements to match your template. Use the following CSS definitions in your template's CSS to alter the appearance of the elements; Bliki adds some additional elements to your page when you use it, so you have the ability to style those elements to match your template. Use the following CSS definitions in your template's CSS to alter the appearance of the elements;
  
-<code css>+<file css style.css>
 #blognew { #blognew {
   font-size: 120%;   font-size: 120%;
Line 503: Line 525:
   float: left;   float: left;
 } }
-</code>+</file>
  
 Again, you can customize these as you see fit, but this is a good starting point. Again, you can customize these as you see fit, but this is a good starting point.
  
 ===== Usage ===== ===== Usage =====
 +
 To create a blog using bliki, you just create a new page, set up the basic template (surrounding the actual blog) and put in the ''%%~~BLIKI~~%%'' tag. When you load that page, you'll see any available blog posts and the option to create a new one. Your actual page might look like this; To create a blog using bliki, you just create a new page, set up the basic template (surrounding the actual blog) and put in the ''%%~~BLIKI~~%%'' tag. When you load that page, you'll see any available blog posts and the option to create a new one. Your actual page might look like this;
  
Line 538: Line 561:
  
 ===== Notes ===== ===== Notes =====
 +
   * Currently will not function properly if ''$conf['userewrite']'' is set to 2 and ''$conf['useslash']'' is set to 0 (zero).   * Currently will not function properly if ''$conf['userewrite']'' is set to 2 and ''$conf['useslash']'' is set to 0 (zero).
   * Creating a new post and editing an existing one is slightly less intuitive than it could be because DokuWiki takes you to that individual entry when you're done, rather than the blog page   * Creating a new post and editing an existing one is slightly less intuitive than it could be because DokuWiki takes you to that individual entry when you're done, rather than the blog page
Line 543: Line 567:
  
 ===== To Do ===== ===== To Do =====
 +
   * Take ACLs into account for new post links   * Take ACLs into account for new post links
   * Use caching?   * Use caching?
  
 ===== Thanks ===== ===== Thanks =====
-  * Andreas Gohr and everyone else who is actively developing DokuWiki - it's the best wiki engine out there!+ 
 +  * Andreas Gohr and everyone else who is actively developing DokuWiki -- it's the best wiki engine out there!
   * Esther Brunner for the [[plugin:include|Include plugin]], which got me started on this one.   * Esther Brunner for the [[plugin:include|Include plugin]], which got me started on this one.
   * Rael Dornfest for the [[http://www.blosxom.com/|blosxom blogging engine]], which was the inspiration for this project.   * Rael Dornfest for the [[http://www.blosxom.com/|blosxom blogging engine]], which was the inspiration for this project.
Line 553: Line 579:
  
 ===== Discussion ===== ===== Discussion =====
 +
 Comments? Comments?
  
Line 606: Line 633:
    $conf['bliki']['namespace'] = "some_namespace"  // ie "comments", "comments:2006", "bliki" or whatever you want    $conf['bliki']['namespace'] = "some_namespace"  // ie "comments", "comments:2006", "bliki" or whatever you want
  
-2. Replace function render() with this: +2. Replace function ''render()'' with this: 
-<code>+<code php>
     function render($mode, &$renderer, $data) {     function render($mode, &$renderer, $data) {
     global $ID, $conf;     global $ID, $conf;
Line 712: Line 739:
    - how will I be able to use categories?    - how will I be able to use categories?
    - is there a simple way to modify the appearance of the entries? I'd like to have a title, instead of the Date over the entry and another color in the background of an entry and it's header...    - is there a simple way to modify the appearance of the entries? I'd like to have a title, instead of the Date over the entry and another color in the background of an entry and it's header...
 +
 +------
 +  - What ever happend to including a link in these pages to a site where the plugin is in use, as an example?  --- [[user>tonybaldwin|tony baldwin]] //2014-08-17 20:59//
plugin/bliki.txt · Last modified: 2023-12-21 17:08 by Aleksandr

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki