Frank Vèssia Posted January 2, 2013 Share Posted January 2, 2013 Happy new year to everybody! I have a problem counting pages. I have a page with a list of paginated "messages" (pages). This works pretty good. In top of the website there is always the navbar with other staff, one of those is the "Messages" link with a small count on the side for the not read emails. I count the total messages using this code inside an external file, not in the page template. function getIncomingmessages(){ if (wire('user')->id){ $userid = wire('user')->id; $member = wire('pages')->get("userid=$userid"); if ($member->id){ return $member->find("template=message,messagetype='inbox',read='',limit=2")->getTotal(); } } } This works pretty good until I go to the next page on my messages page, the pageNum affects also this function in some way, so the total messages return null. I thought the getTotal() always return the total. Link to comment Share on other sites More sharing options...
Frank Vèssia Posted January 2, 2013 Author Share Posted January 2, 2013 Ok i found out the solution, using start=0 inside the selector 2 Link to comment Share on other sites More sharing options...
joshuag Posted January 3, 2013 Share Posted January 3, 2013 Yeah, I run into this every so often and then remember this solution. Thanks for writing it down here. haha. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now