Closed (fixed)
Project:
Drupal core
Version:
8.2.x-dev
Component:
views.module
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
9 Sep 2016 at 06:28 UTC
Updated:
29 Nov 2024 at 10:47 UTC
Jump to comment: Most recent
Comments
Comment #1
d34dman commentedD34dMan created an issue. See original summary.
Comment #2
d34dman commentedComment #3
d34dman commentedWhen inspecting views.tokens.inc it shows that the token "total-rows" is returned as
count($view->result);. This makes me wonder if $view->total_rows has any significance at all.Comment #4
d34dman commentedComment #5
dawehnerThis is basically what you need :)
Comment #7
d34dman commentedThanks for the quick response, much appreciated.
However, i tried the suggestion and its still giving back 2^62.
Here is the code i used for testing in devel/php.
And the output was
Comment #8
d34dman commented$view->get_total_rowssays in todo to move it to count query. That inspired me to try the query way of getting the count.The following code gives back the correct count.
Comment #9
vierlexYou can also use fetchField(); to save yourself the reset() function call afterwards :)
Comment #10
cilefen commentedComment #12
anselmo.temple@tell.com commentedHi all I, How to sort the workflow,
Comment #13
anselmo.temple@tell.com commentedHi all, How to sort the workflow,
Comment #14
therobyouknow commentedPleased to confirm that this solution also works in Drupal 9, 9.3.3: https://www.drupal.org/project/drupal/issues/2797565#comment-11907615
I haven't tried the others yet. But thank you to the solution provider, the question asker and everyone else who contributed.
Comment #15
vensiresThe last responses provided are truly the correct ones. Just adding here for anyone coming from search engines that in case your View is an indexed view using search_api (ex. Solr), then the correct approach is this one: