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 and navigation

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.
  • Add comments tags (optional).

The Pagelist plugin is essentially the pagelist 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


1. quicksel  2012-10-17 14:12

Thanks: 0

thankss

2. elfrenazo  2012-10-18 03:02

Thanks: 0

Thanks, I'll try.

3. Uch  2012-11-10 21:58

Thanks: 0

Thanks!
And it would be great to get ability to cut page title and text and to use PAGE_ROW_OWNER_ tags in a future.

4. Kort  2012-11-11 15:56

Thanks: 0

Uch:

{PAGE_ROW_SHORTTITLE|cot_cutstring($this,150)}

Usertags will be added -- no prob.

5. Uch  2012-11-11 22:46

Thanks: 0

Thans a lot, man! :)

6. Uch  2012-11-12 19:21

Thanks: 0

В файлах pagelist.comments.query.php и pagelist.comments.loop.php надо прописать global $cfg; Иначе опция "Enable comments support" работать не будет.

7. Trustmaster  2012-11-14 06:02

Thanks: 0

Done, thanks for reports!

8. Aristei  2013-06-22 13:26

Thanks: 0

Хороший плагин. Только получается плагины news, resent items теперь нафиг не нужны? Или все-таки для производительности лучше не злоупотреблять им?

9. Ярослав Романенко  2014-01-19 09:28

Thanks: 0

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

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

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

1. новость

 

Спасибо

10. Ярослав Романенко  2014-01-19 09:41

Thanks: 0

Нашел PAGE_ROW_SHORTTITLE 

Total: 10, on page: 10

Only registered users can post new comments