Tested with: WikkaWiki version 1.1.6.4
Example: DescentiaPedia
CommentsClipFooter is the name of an action I included in the footer of DescentiaPedia. I made some changes from the original code (recentcomments.php... or was it recentlycommented.php???) in order to work this into the footer, and to style this to match DescentiaPedia. I have not tested this to see if it can be still used in a page. Nor have I tested this in any version of wikka other than 1.1.6.4. Here is the code:
commentsclipft.php (line 1)
  1. <?php
  2. /**
  3.  * Display a list of recent comments.
  4.  *
  5.  * @package     Actions
  6.  * @name            CommentsClipFooter
  7.  *
  8.  * @author      {@link http://wikkawiki.org/DarTar Dario Taraborelli} (preliminary code cleanup)
  9.  * @author      {@link http://wikkawiki.org/NickDamoulakis Nick Damoulakis} (ACL check)
  10.  * @author      {@link http://wikkawiki.org/WillyP  WillyP} (minor hack to match 'changesclipft' style, and to be able to use this in a footer. Added COMMENT_QTY, more link)
  11.  * @since      
  12.  *
  13.  * @input       none
  14.  * Tested with 1.1.6.4, in the footer only.
  15.  */
  16. //constants
  17. if(!defined('COMMENT_CLIP_DATE_FORMAT')) define('COMMENT_CLIP_DATE_FORMAT', 'D, d M Y');
  18. if(!defined('COMMENT_CLIP_TIME_FORMAT')) define('COMMENT_CLIP_TIME_FORMAT', 'H:i T');
  19. if(!defined('COMMENT_CLIP_SNIPPET_LENGTH')) define('COMMENT_CLIP_SNIPPET_LENGTH', 100);
  20. if(!defined('COMMENT_CLIP_QTY')) define('COMMENT_CLIP_QTY', 5);
  21.  
  22.  
  23.  
  24. //i18n USE WIKI FORMATTING
  25. if (!defined('COMMENTS_CLIP_HEADING')) define('COMMENTS_CLIP_HEADING', '==Recent Comments==');
  26. if (!defined('COMMENT_CLIP_AUTHOR_DIVIDER')) define ('COMMENT_CLIP_AUTHOR_DIVIDER', ', comment by ');
  27. if (!defined('NO_RECENT_COMMENTS_CLIP')) define ('NO_RECENT_COMMENTS_CLIP', 'There are no recent comments%s');
  28. if (!defined('NO_READABLE_RECENT_COMMENTS_CLIP')) define ('NO_READABLE_RECENT_COMMENTS_CLIP', 'There are no recent comments you can read.');
  29. if(!defined('COMMENT_CLIP_MORE')) define('COMMENT_CLIP_MORE', '**//[[RecentlyCommented]]//**');
  30. $readable = 0;
  31.  
  32. $username = '';
  33. if(isset($_REQUEST['user']))
  34. {
  35.     $username = $this->htmlspecialchars_ent($_REQUEST['user']);
  36. }
  37.  
  38. echo $this->Format(COMMENTS_CLIP_HEADING);
  39. if ($comments = $this->LoadRecentComments(COMMENT_CLIP_QTY, $username))
  40. {
  41.     $curday = '';
  42.     foreach ($comments as $comment)
  43.     {
  44.         if ($this->HasAccess('comment', $comment['page_tag']))
  45.         {
  46.             $readable++;
  47.             // day header
  48.             list($day, $time) = explode(' ', $comment['time']);
  49.             if ($day != $curday)
  50.             {
  51.                 $dateformatted = date(COMMENT_CLIP_DATE_FORMAT, strtotime($day));
  52.             }
  53.  
  54.             $timeformatted = date(COMMENT_CLIP_TIME_FORMAT, strtotime($comment['time']));
  55.             $comment_preview = str_replace('<br />', '', $comment['comment']);
  56.             $comment_preview = substr($comment_preview, 0, COMMENT_CLIP_SNIPPET_LENGTH);
  57.             if (strlen($comment['comment']) > COMMENT_CLIP_SNIPPET_LENGTH)
  58.             {
  59.                 $comment_preview = $comment_preview.'&#8230;';
  60.             }
  61. $pagetag = $page["tag"];
  62.             if ($this->HasAccess("read", $pagetag))
  63.             {   print '<span class="clip">'.($this->Link($comment['page_tag']).':&nbsp;'.$comment_preview.'<br />&nbsp;&nbsp;'.$dateformatted.'&nbsp;'.$timeformatted."&nbsp;&nbsp;by: ".$this->Format($comment['user'])."</span><br />");
  64.             }
  65.         }
  66.     }
  67.     if ($readable == 0)
  68.     {
  69.         echo '<em class="error">'.NO_READABLE_RECENT_COMMENTS_CLIP.'</em><br />';
  70.     }
  71. }
  72. else
  73. {
  74.     if(!empty($username))
  75.     {
  76.         echo '<em class="error">'.sprintf(NO_RECENT_COMMENTS_CLIP, " by $username.").'</em><br />';
  77.     }
  78.     else
  79.     {
  80.         echo '<em class="error">'.sprintf(NO_RECENT_COMMENTS_CLIP, ".").'</em><br />';
  81.     }
  82. }
  83. echo '<span class="clip">'. ($this->Format(COMMENT_CLIP_MORE))."</span>";
  84. ?>



See also:
ActionsInFooter

Categories:
CategoryStyle
There are no comments on this page.
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki