$ view-> total_rows是错误的(排序),我想要“要显示的项目” [英] $view->total_rows is wrong (sort of), I want "Items to display"
问题描述
我的视图的 total_rows
属性返回总行(22),但不返回我设置要显示的视图的项数(5)(通过网页界面阻止 - > 基本设置)
如何在没有依赖的情况下以正确的方式获得这个(可能即将被废弃的结果
属性?
现在我使用
$ totalRows = min($ view-> total_rows,count($ view-> result));
这是始终可用的:
$ view-> display ['your_display'] - > ; display_options ['items_per_page']
其中 your_display
被视图显示您正在使用(例如 page_1
, block_1
等),这在构建过程的所有阶段都可用。 p>
The "total_rows
" property of my view returns the total rows (22), but not the number of items I have set the view to display (5) (through the Web UI Block->Basic Settings).
How can I get this in a proper way without relying on (the possibly soon to be deprecated "result
" property?
for now Im using
$totalRows = min($view->total_rows, count($view->result));
This is always available as:
$view->display['your_display']->display_options['items_per_page']
where your_display
is replaced by the views display you are using (e.g. page_1
, block_1
, etc). This is available at all stages of building process.
这篇关于$ view-> total_rows是错误的(排序),我想要“要显示的项目”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!