DokuWiki

It's better when it's simple

User Tools

Site Tools


tips:prettyrecentfix

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
tips:prettyrecentfix [2010-02-20 23:36] 164.67.235.79tips:prettyrecentfix [2012-11-24 10:47] (current) – deprecated: only for 2005 version of dw flam
Line 1: Line 1:
-====== Introduction ====== 
  
-This tips gives you a "Recents" page in a more pretty way. You have the different changes set by day. 
- 
-This is an updated and enhanced version of the orginal work of [[http://ktyp.com/dev/doku/dokuwiki/hacks/prettyrecent]] and the "old version" below and the Dokuwiki source.  Thanks to the original authors of this work. --- //[[mailto:jpgnews1 at ouvaton dot org|Jean-Philippe Georget]] 2005-10-17 11:26// 
- 
-====== HowTo ====== 
- 
-===== for 2005-09-19 version ===== 
- 
-To obtain pretty recents pages, in your **./inc/html.php** file, replace the **html_recent()** function with: 
- 
-<code php> 
- 
-function html_recent($first=0){ 
-  global $conf; 
-  global $lang; 
-  global $ID; 
- 
-  $recents = getRecents($first,$conf['recent'] + 1,true,getNS($ID));  
-  print p_locale_xhtml('recent'); 
-  // counter initialization 
-  $cdate = '0000-00-00'; 
-  echo $recents[$id]['date']; 
-  foreach($recents as $id => $val){ 
-    if(date("Y-m-d",$val['date']) != $cdate){ 
-  
-      echo '<h1><b>',date($conf['dformat'],$val['date']),'</b></h1>',"\n"; 
- 
-      $cdate = date("Y-m-d",$val['date']); 
- 
-     } 
-   
-    $date = date($conf['dformat'],$val['date']); 
-  
-    print '<div class="level2">'; 
- 
-    print $date.' '.html_wikilink($id,$id); 
- 
-    print '<a href="'.wl($val['id'],"do=diff").'">'; 
-    $p = array(); 
-    $p['src'   = DOKU_BASE.'lib/images/diff.png'; 
-    $p['border'] = 0; 
-    $p['width' = 15; 
-    $p['height'] = 11; 
-    $p['title' = $lang['diff']; 
-    $p['alt'   = $lang['diff']; 
-    $att = buildAttributes($p); 
-    print "<img $att />"; 
-    print '</a> '; 
- 
-    print '<a href="'.wl($val['id'],"do=revisions").'">'; 
-    $p = array(); 
-    $p['src'   = DOKU_BASE.'lib/images/history.png'; 
-    $p['border'] = 0; 
-    $p['width' = 12; 
-    $p['height'] = 14; 
-    $p['title' = $lang['btn_revs']; 
-    $p['alt'   = $lang['btn_revs']; 
-    $att = buildAttributes($p); 
-    print "<img $att />"; 
-    print '</a> '; 
- 
-    print html_wikilink(':'.$val['id'],$conf['useheading']?NULL:$val['id']); 
-    print ' '.htmlspecialchars($val['sum']); 
-    print ' <span class="user">'; 
-    if($val['user']){ 
-      print $val['user']; 
-      // if you prefer display the real name instead of the username 
-      // comment the previous line  "print $val['user'];"  
-      // and decomment the 2 following lines  
-      // $userdata = auth_getUserData($val['user']); 
-      // print $userdata['name']; 
-    }else{ 
-      print $val['ip']; 
-    } 
-    print '</span>'; 
-    print '</div>'; 
-    print "\n"; 
-  } 
- 
-  print '<div class="pagenav">'; 
-  $last = $first + $conf['recent']; 
-  if ($first > 0) { 
-    $first -= $conf['recent'];  
-    if ($first < 0) $first = 0; 
-    print '<div class="pagenav-prev">'; 
-    print html_btn('newer','',"p",array('do' => 'recent', 'first' => $first)); 
-    print '</div>'; 
-  } 
-  if ($conf['recent'] < count($recents)) { 
-    print '<div class="pagenav-next">'; 
-    print html_btn('older','',"n",array('do' => 'recent', 'first' => $last)); 
-    print '</div>'; 
-  } 
-  print '</div>'; 
-} 
-</code> 
- 
-===== Old version ===== 
- 
-I updated this script to work with the July 1st Revision. 
-<code php> 
-function html_recent($first=0){ 
-  global $conf; 
-  global $lang; 
- 
-  /* we need to get one additionally log entry to be able to 
-   * decide if this is the last page or is there another one. 
-   * This is the cheapest solution to get this information. 
-   */ 
-  $recents = getRecents($first,$conf['recent'] + 1,true); 
-  if(count($recents) == 0 && $first != 0){ 
-    $first=0; 
-    $recents = getRecents(0,$conf['recent'] + 1,true); 
-  } 
-  $cnt = count($recents) <= $conf['recent'] ? count($recents) : $conf['recent'];  
-   
-  print p_locale_xhtml('recent'); 
-   
-  $cdate = '0000-00-00'; 
-  foreach($recents as $id => $val){ 
-    if(date("Y-m-d",$val['date']) != $cdate){ 
-  
-      echo '<h1><b>',date("F d, Y",$val['date']),'</b></h1>',"\n"; 
-      $cdate = date("Y-m-d",$val['date']); 
-     } 
-   
-    $date = date('H:i',$val['date']); 
-  
-    print '<div class="level2">'; 
-    print $date.' '.html_wikilink($id,$id); 
-    print ' '.htmlspecialchars($val['sum']); 
-    print ' <span class="user">('; 
-    print $val['ip']; 
-    if($val['user']) print ' '.$val['user']; 
-    print ')</span>'; 
-    print '</div>'; 
-    print "\n"; 
-  } 
-} 
-</code> 
- 
-====== Discussion ====== 
- 
-  * Could it be included in the main source (perhaps as an option) ? 
- 
-> If you want the real name instead of the username on each line, change the following: 
- 
-<code php> 
-    if($val['user']){ 
-      print $val['user']; 
-</code> 
- 
-> to: 
- 
-<code php> 
-    if($val['user']){ 
-      $userdata = auth_getUserData($val['user']); 
-      print $userdata['name']; 
-</code> 
- 
- --- //[[chris@chrisarndt.de|ChristopherArndt]] 2005-10-17 13:22// 
->> Thanks, I added your tip as an "option" in the code ;-) Sometimes, you don't want to have the real names appear on the web site. //[[mailto:jpgnews1 at ouvaton dot org|Jean-Philippe Georget]] 2005-10-17 21:37// 
tips/prettyrecentfix.1266705397.txt.gz · Last modified: 2010-02-20 23:36 by 164.67.235.79

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