Changeset 746
- Timestamp:
- 12/07/06 17:22:32 (2 years ago)
- Files:
-
- devel/htaccess-dist (modified) (1 diff)
- devel/units/weblogs/default_template.php (modified) (2 diffs)
- devel/units/weblogs/weblogs_posts_view.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
devel/htaccess-dist
r707 r746 73 73 RewriteRule ^([A-Za-z0-9]+)\/weblog\/rssnot\/(.+)\/?$ _weblog/rss2.php?weblog_name=$1&tag=$2&modifier=not 74 74 RewriteRule ^[A-Za-z0-9]+\/weblog\/([0-9]+)\.html$ _weblog/view_post.php?post=$1 75 RewriteRule ^[A-Za-z0-9]+\/weblog\/([0-9]+)\.html.([0-9]+)$ _weblog/view_post.php?post=$1&commentpage=$2 75 76 76 77 RewriteRule ^tag\/(.+)\/?$ search/all.php?tag=$1 devel/units/weblogs/default_template.php
r690 r746 51 51 'description' => __gettext("A placeholder for weblog comments."), 52 52 'glossary' => array( 53 '{{comments}}' => __gettext('The list of comments themselves') 53 '{{comments}}' => __gettext('The list of comments themselves'), 54 '{{paging}}' => __gettext('The list of page links when there are lots of comments') 54 55 ) 55 56 ); … … 62 63 <div id="comments"><!-- start comments div --> 63 64 <h4>$comments</h4> 65 <div>{{paging}}</div> 64 66 <ol> 65 67 {{comments}} 66 68 </ol> 69 <div>{{paging}}</div> 67 70 </div><!-- end comments div --> 68 71 END; devel/units/weblogs/weblogs_posts_view.php
r703 r746 141 141 // if post exists and is visible 142 142 143 //which page of comments to display (page numbers are 0-based) 144 $page = optional_param('commentpage', 0, PARAM_INT); 145 $perpage = 20; // set to 0/false to disable paging 146 $offset = $page * $perpage; 147 $thispageurl = $CFG->wwwroot . $username . "/weblog/" . $post->ident . ".html"; 148 143 149 if ($comments = get_records('weblog_comments','post_id',$post->ident,'posted ASC')) { 150 $numcomments = count($comments); 151 if (!empty($perpage) && $numcomments > $perpage) { 152 $comments = array_slice($comments, $offset, $perpage); 153 $numpages = ceil($numcomments / $perpage); 154 $pagelinks = __gettext("Page: "); 155 for ($i = 1; $i <= $numpages; $i++) { 156 $pagenum = $i - 1; 157 if ($pagenum != $page) { 158 $pageurl = $thispageurl . (($pagenum) ? '.' . $pagenum : ''); 159 $pagelinks .= ' <a href="' . $pageurl . '">' . $i . '</a>' ; 160 } else { 161 $pagelinks .= ' ' . $i . ' '; 162 } 163 164 } 165 $thispageurl .= '.' . $page; 166 } 167 144 168 foreach($comments as $comment) { 145 169 $commentmenu = ""; … … 175 199 'posted' => strftime("%A, %e %B %Y, %R %Z",$comment->posted), 176 200 'usericon' => $comment->icon, 177 'permalink' => $ CFG->wwwroot . $username . "/weblog/{$post->ident}.html#cmt" . $comment->ident201 'permalink' => $thispageurl . "#cmt" . $comment->ident 178 202 ) 179 203 ); … … 182 206 $commentsbody = templates_draw(array( 183 207 'context' => 'weblogcomments', 208 'paging' => $pagelinks, 184 209 'comments' => $commentsbody 185 210 )
