当前位置: 首页>>代码示例>>PHP>>正文


PHP Comments::get_layout方法代码示例

本文整理汇总了PHP中Comments::get_layout方法的典型用法代码示例。如果您正苦于以下问题:PHP Comments::get_layout方法的具体用法?PHP Comments::get_layout怎么用?PHP Comments::get_layout使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Comments的用法示例。


在下文中一共展示了Comments::get_layout方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: array

     }
     // make a complete box
     if ($content) {
         $text .= Skin::build_box(i18n::s('Hidden pages'), $content, 'header1', 'articles');
     }
 }
 // title label
 $title_label = '';
 if (is_object($overlay)) {
     $title_label = $overlay->get_label('list_title', 'comments');
 }
 if (!$title_label) {
     $title_label = i18n::s('Comments');
 }
 // get a layout for these comments
 $layout =& Comments::get_layout($anchor, $item);
 // the maximum number of comments per page
 if (is_object($layout)) {
     $items_per_page = $layout->items_per_page();
 } else {
     $items_per_page = COMMENTS_PER_PAGE;
 }
 // the first comment to list
 $offset = ($zoom_index - 1) * $items_per_page;
 if (is_object($layout) && method_exists($layout, 'set_offset')) {
     $layout->set_offset($offset);
 }
 // build a complete box
 $box = array('bar' => array(), 'text' => '');
 // new comments are allowed
 if (Comments::allow_creation($item, $anchor, 'section')) {
开发者ID:rair,项目名称:yacs,代码行数:31,代码来源:view_as_tabs.php

示例2: layout


//.........这里部分代码省略.........
         if ($page == 1 && $count > 1) {
             // the command to download all files
             $link = 'files/fetch_all.php?anchor=' . urlencode('article:' . $item['id']);
             if ($count > 20) {
                 $label = i18n::s('Zip 20 first files');
             } else {
                 $label = i18n::s('Zip all files');
             }
             $box['bar'] += array($link => $label);
         }
         // there is some box content
         if ($box['text']) {
             $text .= Skin::build_content('files', i18n::s('Files'), $box['text'], $box['bar']);
         }
         // list of comments
         $title_label = '';
         if (is_object($anchor)) {
             $title_label = ucfirst($overlay->get_label('list_title', 'comments'));
         }
         if (!$title_label) {
             $title_label = i18n::s('Comments');
         }
         // no layout yet
         $layout = NULL;
         // label to create a comment
         $add_label = '';
         if (is_object($overlay)) {
             $add_label = $overlay->get_label('new_command', 'comments');
         }
         if (!$add_label) {
             $add_label = i18n::s('Post a comment');
         }
         // get a layout from anchor
         $layout =& Comments::get_layout($anchor, $item);
         // provide author information to layout
         if (is_object($layout) && isset($item['create_id']) && $item['create_id']) {
             $layout->set_focus('user:' . $item['create_id']);
         }
         // the maximum number of comments per page
         if (is_object($layout)) {
             $items_per_page = $layout->items_per_page();
         } else {
             $items_per_page = COMMENTS_PER_PAGE;
         }
         // the first comment to list
         $offset = 0;
         if (is_object($layout) && method_exists($layout, 'set_offset')) {
             $layout->set_offset($offset);
         }
         // build a complete box
         $box = array('bar' => array(), 'prefix_bar' => array(), 'text' => '');
         // feed the wall
         if (Comments::allow_creation($item, $anchor)) {
             $box['text'] .= Comments::get_form('article:' . $item['id']);
         }
         // a navigation bar for these comments
         if ($count = Comments::count_for_anchor('article:' . $item['id'])) {
             if ($count > 20) {
                 $box['bar'] += array('_count' => sprintf(i18n::ns('%d comment', '%d comments', $count), $count));
             }
             // list comments by date
             $items = Comments::list_by_date_for_anchor('article:' . $item['id'], $offset, $items_per_page, $layout, TRUE);
             // actually render the html
             if (is_array($items)) {
                 $box['text'] .= Skin::build_list($items, 'rows');
             } elseif (is_string($items)) {
开发者ID:rair,项目名称:yacs,代码行数:67,代码来源:layout_articles_as_tabs.php

示例3: render_json

 /**
  * render comment as json format
  * 
  * @param int $id of the comment
  * @param object $anchor of the comment
  */
 public static function render_json($id, $anchor)
 {
     // we'll return json
     $output = '';
     // get layout and render last comment
     $layout = Comments::get_layout($anchor);
     $layout->set_variant('no_wrap');
     $rendering = Comments::list_by_date_for_anchor($anchor, 0, 1, $layout, true);
     $output = json_encode(array('entity' => 'comment', 'id' => $id, 'anchor' => $anchor->get_reference(), 'html' => $rendering));
     // allow for data compression
     render_raw('application/json');
     echo $output;
     // the post-processing hook, then exit
     finalize_page(TRUE);
 }
开发者ID:rair,项目名称:yacs,代码行数:21,代码来源:comments.php

示例4: array

        $menu = array();
        if ($anchor->has_layout('alistapart')) {
            $menu[] = Skin::build_link($anchor->get_url('parent'), i18n::s('Done'), 'button');
        } else {
            $menu[] = Skin::build_link($anchor->get_url(), i18n::s('Done'), 'button');
        }
        $context['text'] .= Skin::finalize_list($menu, 'assistant_bar');
    }
    // insert anchor suffix
    if (is_object($anchor)) {
        $context['text'] .= $anchor->get_suffix();
    }
} else {
    ///// json output
    // get comment layout
    $layout = Comments::get_layout($anchor);
    // set variant, if any
    if (isset($_REQUEST['variant'])) {
        $layout->set_variant($_REQUEST['variant']);
    }
    // get offset
    $offset = isset($_REQUEST['start']) && is_numeric($_REQUEST['start']) ? $_REQUEST['start'] : 0;
    $count = isset($_REQUEST['batch']) && is_numeric($_REQUEST['batch']) ? $_REQUEST['batch'] : COMMENTS_PER_PAGE;
    // do the request, get them from the end (reversed)
    $comments = Comments::list_by_date_for_anchor($anchor, $offset, $count, $layout, true);
    // how many left for next batch ?
    $comment_left = Comments::count_for_anchor($anchor) - $offset - $count;
    $output = json_encode(array('comments' => $comments, 'anchor' => $anchor->get_reference(), 'left' => $comment_left));
    // allow for data compression
    render_raw('application/json');
    echo $output;
开发者ID:rair,项目名称:yacs,代码行数:31,代码来源:list.php


注:本文中的Comments::get_layout方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。