root/branches/release-35/php/lib/function.mtentriescount.php @ 1956

Revision 1956, 0.9 kB (checked in by bchoate, 20 months ago)

Added support for phrases on count tags. BugId:79359

Line 
1<?php
2# Movable Type (r) Open Source (C) 2001-2008 Six Apart, Ltd.
3# This program is distributed under the terms of the
4# GNU General Public License, version 2.
5#
6# $Id$
7
8function smarty_function_mtentriescount($args, &$ctx) {
9    if ($ctx->stash('inside_mt_categories')) {
10        return $ctx->tag('MTCategoryCount', $args);
11    } elseif ($count = $ctx->stash('archive_count')) {
12        # $count is set
13    } else {
14        $entries = $ctx->stash('entries');
15        if (!is_array($entries)){
16            $blog = $ctx->stash('blog');
17            $args['blog_id'] = $blog['blog_id'];
18            $entries =& $ctx->mt->db->fetch_entries($args);
19        }
20   
21        $lastn = $ctx->stash('_entries_lastn');
22        if ($lastn && $lastn <= count($entries))
23            $count = $lastn;
24        else
25            $count = count($entries);
26    }
27    return $ctx->count_format($count, $args);
28}
Note: See TracBrowser for help on using the browser.