kharanenka/oc-pagination

为 OctoberCMS 获取分页元素

1.0.2 2016-12-10 18:40 UTC

This package is auto-updated.

Last update: 2024-08-29 04:31:10 UTC


README

您可以使用具有 "Pagination" 类的分页元素。参见 php-pagination 包。您可以从示例 oc-pagination/src/Kharanenka/lang/en/lang.php 复制语言文件。

#安装 在您的 composer.json 中包含此包并更新 composer。

"kharanenka/oc-pagination": "1.0.*"

#组件属性

public function defineProperties()
{
    $arProperties = [
        //Component property array
    ];
    
    $arProperties = array_merge($arProperties, Pagination::getProperties('plugin_name'));
    return $arProperties;
}

用法

//$arSettings = $this->properties
$arPagination = Pagination::get($iCurrentPage, $iTotalCount, $arSettings);
 

#结果

[
    [
        'name' => 'First',
        'value' => 1,
        'class' => 'pagination-first-button',
        'code' => 'first',
    ],
    ...
    [
        'name' => '3',
        'value' => 3,
        'class' => 'pagination-i _act',
        'code' => null,
    ],
    ...
    [
        'name' => 'Last',
        'value' => 10,
        'class' => 'pagination-last-button',
        'code' => 'last',
    ]
]