Fork me on GitHub
Please upgrade to 2.1.x here. The 2.0 branch is no longer being updated.
You should grab 2.1.9, released 18 March. It's what all the cool kids are doing.

show the comment box only on last page of discussion

fh111fh111 Vanilla Padawan ✭✭
edited May 2012 in Vanilla 2.0 Help

how would it work?

i am in /views/discussion/index.php and i guess i could put a && condition in there checking if on last page. i just don't get it enough yet to know what to put

} else if ($Session->IsValid() && $Session->CheckPermission('Vanilla.Comments.Add', TRUE, 'Category', $this->Discussion->PermissionCategoryID)) {
   echo $this->FetchView('comment', 'post');

any help appreciated, thanks

Answers

  • peregrineperegrine MVP
    edited May 2012

    look in vanilla/applications/dashboard/modules/classpagermodule.php for guidance
    if you

    if ($PagerOptions["RecordCount"] >  $PagerOptions["CurrentRecords"])
      // probably means you are on the lastpage.
    

    there is also a function if you can figure out how to access it.

      /**
        * Whether or not this is the last page of the pager.
        *
        * @return bool True if this is the last page.
        */
       public function LastPage() {
          return $this->Offset + $this->Limit >= $this->TotalRecords;
       }
    

    someone with more knowledge could probably tell you more ..

    fh111
  • fh111fh111 Vanilla Padawan ✭✭

    interesting, thanks! i'll take a look at this when i have a minute

Sign In or Register to comment.