block.mtblogs.php

来自「1. 记录每个帖子的访问人情况」· PHP 代码 · 共 28 行

PHP
28
字号
<?phpfunction smarty_block_MTBlogs($args, $content, &$ctx, &$repeat) {    // status: complete    // parameters: none    // notes: is it sorting in the right order???    if (!isset($content)) {        $ctx->localize(array('_blogs', '_blogs_counter', 'blog', 'blog_id'));        $blogs = $ctx->mt->db->load('blog');        $ctx->stash('_blogs', $blogs);        $counter = 0;    } else {        $blogs = $ctx->stash('_blogs');        $counter = $ctx->stash('_blogs_counter');    }    if ($counter < count($blogs)) {        $blog = $blogs[$counter];        $ctx->stash('blog', $blog);        $ctx->stash('blog_id', $blog['blog_id']);        $ctx->stash('_blogs_counter', $counter + 1);        $repeat = true;    } else {        $ctx->restore(array('_blogs', '_blogs_counter', 'blog', 'blog_id'));        $repeat = false;    }    return $content;}?>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?