root/branches/release-39/php/lib/function.mttagsearchlink.php @ 2440

Revision 2440, 1.3 kB (checked in by fumiakiy, 18 months ago)

Add limit parameter to the tag search link. BugId:79918

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_mttagsearchlink($args, &$ctx) {
9    $tag = $ctx->stash('Tag');
10    if (!$tag) return '';
11    if (is_array($tag)) {
12        $name = $tag['tag_name'];
13    } else {
14        $name = $tag;
15    }
16
17    $param = '';
18    if ($include_blogs = $args['include_blogs'] ? $args['include_blogs'] : $ctx->stash('include_blogs')) {
19        if ($args['include_blogs'] != 'all') {
20            $param = 'IncludeBlogs=' . $include_blogs;
21        }
22    } elseif ($exclude_blogs = $args['exclude_blogs'] ? $args['exclude_blogs'] : $ctx->stash('exclude_blogs')) {
23        $param = 'ExcludeBlogs=' . $exclude_blogs;
24    } elseif ($blog_ids = $args['blog_ids'] ? $args['blog_ids'] : $ctx->stash('blog_ids')) {
25        $param = 'IncludeBlogs=' . $blog_ids;
26    } else {
27        $blog_id = $ctx->stash('blog_id');
28        $param = 'blog_id=' . $blog_id;
29    }
30
31    if ( $param )
32        $param .= '&amp;';
33    $param .= 'limit=' . $ctx->mt->config('MaxResults');
34    require_once "function.mtcgipath.php";
35    $search = smarty_function_mtcgipath($args, $ctx);
36    $search .= $ctx->mt->config('SearchScript');
37    return $search . '?tag=' . urlencode($name) . ($param ? '&amp;' . $param : '');
38}
39?>
Note: See TracBrowser for help on using the browser.