0

I have made a view getting the new content added and new comments

But i need to get its count and so i usedthe following code

$view = views_get_view('new_activity');

$view->set_arguments(array(arg(2)));

$view->execute();

return l(count($view->result), 'new-activity/' . arg(2));

but i see untrue number related to the view page

how to fix it espicially using history_timestamp attribute of each row

the main problem is that the views gets , data and hide the viewed rows and only shows the unviewed rows which gives me wrong count

please help or advice with a better scenario

thanks in advance

0

count($view->results) will only give you the number of the results on the current page if using a paged View. Try using $view->total_rows instead, which will give you the total number of rows returned by the View:

return l($view->total_rows, 'new-activity/' . arg(2));
  • Hi Please describing your answers, rather than adding a single line. Also in your other answers. – niksmac Dec 12 '12 at 2:31
  • @Artem M. I tried that answer but the problem is how to know the unread comments and content for the user coz the rows gets all data and when rendering the rows i found the markup without content for the unread or new (Has new content ) – Mohammed Gomma Dec 12 '12 at 7:49
  • @Nikhil M Fair enough, I've edited the answer. – jamix Dec 12 '12 at 8:40
  • @Mhmdgomma I suspect that the problem may be specific to the View you're using. You might want to paste its export to explain the issue better. – jamix Dec 12 '12 at 8:42
  • @Artem M. The view shows number of rows identical to the count but when seeing the view page the number of seen rows less than the total rows i see empty rows with the markup using firebug so the issue is how new content drupal deals with it another point of view how to get the count of new content and comments per user ??? – Mohammed Gomma Dec 12 '12 at 13:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.