Extensions / Navigation & Structure / Pagelist

This plugin creates sets of objects from Page module to form widgets, page lists, news blocks, navigation, top-lists etc.

#1. Description

The Pagelist plugin is a universal solution that may be used to build widgets, virtual page lists and navigation. The plugin enables you to complete the following tasks:

  • Output news feed without parent folder limitations with customized pagination, sorting and element (page) selection conditions
  • Build widgets of the following types: “Recent Additions”, “Top Pages”, “Random Pages” etc with customizable sorting and element selection conditions
  • Build navigation elements and any types of widgets based on the Page module
  • Generate User tags (optional)
  • Generate Star Ratings tags (optional)
  • Generate Comments count tags via {PAGE_ROW_ID|cot_comments_count('page', $this)|cot_declension($this, 'Comments')}

The Pagelist plugin is essentially a function and is used via callbacks:

function pagelist(
    $tpl = 'pagelist',
    $items = 20,
    $order = 'page_date DESC',
    $condition = '',
    $cat = '',
    $blacklist = '',
    $whitelist = '',
    $sub = true,
    $pagination = 'pld',
    $noself = false,
    $offset = 0

The callback parameters are as follows:

  1. $tpl – template code (without extension, i.e. pagelist.recentitems)
  2. $items – numberof elements to display (optional, i.e. 5)
  3. $order – sorting order (optional, i.e. page_date DESC)
  4. $condition –query condition (optional, i.e. page_some-extrafield = “1”)
  5. $cat- parent folder (optional, i.e. blog)
  6. $blacklist – categoryblacklist (optional, separated with semicolon, i.e. system;some-cat)
  7. $whitelist – category whitelist (optional, separated with semicolon, i.e., hot;podcasts)
  8. $sub – include subcategories (optiomal, i.e. true)
  9. $pagination – pagination parameter name (optional, i.e. pld – make sure names do not conflict!)
  10. $noself – exclude current page from list (optional, i.e. true)
  11. $offset – exclude number of most recent posts

#2. Examples

The plugin uses the pagelist function to build own template in the specified placeholder. Due to this feature it enables website developer to build such blocks as blog feeds, recent items / top items widgets etc.

Build blog feed – selec t pages from all categories except system and archives, sort by date ASC and build pagination with 8 elements per page:

{PHP|pagelist('pagelist.blog','8','page_date DESC','','','system;archives','','TRUE')}

Build “Top-3” widget – 3 pages with non-zero hits sorted by hits DESC except pages from the system category:

{PHP|pagelist('pagelist.top','3','page_count DESC','page_count != "0"','','system','','')}

Build “About us” widget – 1 page with about alias from the system category:

{PHP|pagelist('pagelist.about','','','page_alias = "about"','system','','','')}

#3. Template Structure

The model template has the following format:

<!-- BEGIN: MAIN -->
<!-- BEGIN: PAGE_ROW -->
        <li><a href="{PAGE_ROW_URL}">{PAGE_ROW_TITLE}</a></li>
<!-- END: PAGE_ROW -->
    <div class="pagination">
<!-- ENDIF -->
<!-- END: MAIN -->

The PAGE_ROW_ regular block is used to output elements generated with the cot_generate_pagetags() function prefixed with PAGE_ROW_.

The following additional tags are available:

  • {PAGE_ROW_NUM} (element number)
  • {PAGE_ROW_ODDEVEN} (odd/even)
  • {PAGE_ROW_RAW} (raw data from the db in the {PAGE_ROW_RAW.page_alias} format)

Once Comments plugin linkage is enabled in the config the following tags become available: PAGE_ROW_COMMENTS and PAGE_ROW_COMMENTS_COUNT.

Feel free to discuss the plugin at our forums: Pagelist Plugin or fork on github

1. CrazyFreeMan  2014-01-19 09:28

Подскажите как выводить список новостей просто с TITLE новости, а то у меня получается хлебные крошки:

1. категория / подкатегория / новость

хочу получить 

1. новость



2. CrazyFreeMan  2014-01-19 09:41


3. pasha_link  2015-11-17 06:08

Как выводить все, кроме самого последнего поста категории?

4. Kort  2015-12-08 14:37

Наверно для такого лучше всего написать свой миниплагин )

5. Chiaroscuro  2016-03-16 09:00

Как на счет кеширования информации?

6. Macik  2016-03-22 23:54

For more complex needs you can use `cot_page_enum()` function (available for Cotonti 0.9.19 Page API)

7. Kort  2016-08-19 06:50

Плагин обновился: добавилась опция offset (по просьбе pasha_link)

8. CrazyFreeMan  2016-10-29 07:17

 как пользоватся i18n ? А то перевод есть, в запросе вижу выборку но на странице показывает основной язык а не перевод

9. CrazyFreeMan  2016-10-29 08:04

Для корректной работы перевода у себя вот тут добавил:

global $i18n_enabled, $i18n_read;
$i18n_enabled = $i18n_read && cot_i18n_enabled($row['page_cat']);

Total: 9, on page: 9

Only registered users can post new comments