root/branches/release-26/php/lib/block.mtentrycategories.php @ 1174

Revision 1174, 1.1 kB (checked in by bchoate, 23 months ago)

Updated copyright year for source.

  • Property svn:keywords set to Author Date Id Revision
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_block_mtentrycategories($args, $content, &$ctx, &$repeat) {
9    $localvars = array('_categories', 'category', '_categories_counter');
10    if (!isset($content)) {
11        $ctx->localize($localvars);
12        $entry = $ctx->stash('entry');
13        $args['entry_id'] = $entry['entry_id'];
14        $categories = $ctx->mt->db->fetch_categories($args);
15        $ctx->stash('_categories', $categories);
16        $counter = 0;
17    } else {
18        $categories = $ctx->stash('_categories');
19        $counter = $ctx->stash('_categories_counter');
20    }
21    if ($counter < count($categories)) {
22        $category = $categories[$counter];
23        $ctx->stash('category', $category);
24        $ctx->stash('_categories_counter', $counter + 1);
25        $repeat = true;
26        if (($counter > 0) && isset($args['glue'])) {
27            $content = $content . $args['glue'];
28        }
29    } else {
30        $ctx->restore($localvars);
31        $repeat = false;
32    }
33    return $content;
34}
35?>
Note: See TracBrowser for help on using the browser.