How many nodes from a view?

Alex72RM - December 16, 2008 - 15:03
Project:Insert View
Version:5.x-1.0
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:active
Description

Hi,

I'm asking myself if is it possible to know how many nodes a "[view:name of view]"-tag return.

It should be very useful to build conditional php statements.

Thanks,
Alessandro

#1

mlsamuelson - December 18, 2008 - 19:50
Status:active» fixed

In Drupal 5 you can use [view:name of view=x] where x is the number of node results to display.

(BTW, in Drupal 6, you cannot control the number of nodes in the tag. Instead, you would set the number of results to show in the view's display.)

#2

Alex72RM - December 20, 2008 - 18:21
Status:fixed» active

No, I need to know in advance how many nodes are in the view, 'cause I must perform a particular action when nodes number is zero.

#3

midkemia - December 20, 2008 - 18:45

Why not put some code in the view on empty field ?

#4

Alex72RM - December 21, 2008 - 18:26

Uhm... it should be a good solution, but I don't know how to manage the related output.

Have you some more hint?

Thanks a lot,
Alessandro

#5

midkemia - December 22, 2008 - 11:41

Not really knowing what you need to do and also being no expert :)

insert view will display the view when it has content, or not

In views there is a field for empty text, which will take php, so if your view contains no results it displays the content of that field, so by putting your action in there you should achive what you want

 
 

Drupal is a registered trademark of Dries Buytaert.