Cotonti / Open Source PHP Content Management FrameworkContent Management Framework

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
)

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)

#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 -->
    <ul>
<!-- BEGIN: PAGE_ROW -->
        <li><a href="{PAGE_ROW_URL}">{PAGE_ROW_TITLE}</a></li>
<!-- END: PAGE_ROW -->
    </ul>
 
<!-- IF {PAGE_TOP_PAGINATION} -->
    <div class="pagination">
        {PAGE_TOP_PAGEPREV} {PAGE_TOP_PAGINATION} {PAGE_TOP_PAGENEXT}
    </div>
<!-- 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

Thanks: 0

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

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

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

1. новость

 

Спасибо

2. CrazyFreeMan  2014-01-19 09:41

Thanks: 0

Нашел PAGE_ROW_SHORTTITLE 

3. pasha_link  2015-11-17 06:08

Thanks: 0

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

4. Kort  2015-12-08 14:37

Thanks: 0

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

5. Chiaroscuro  2016-03-16 09:00

Thanks: 0

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

6. Macik  2016-03-22 23:54

Thanks: 0

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

Total: 6, on page: 6

Only registered users can post new comments