Jump to:

23007 Posts in 11866 Topics by 2828 members

General Questions

SilverStripe Forums » General Questions » ss 3.0.2 timed out session on reload search results

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 377 Views
  • longy
    Avatar
    Community Member
    5 Posts

    ss 3.0.2 timed out session on reload search results Link to this post

    Following this guide: SearchContext Guide, I built a custom search with pagination, but if i reload result page (by pressing f5) or change page (by pagination links) i get an unformatted page with the following message:

    Sorry, your session has timed out.

    If if could serve after I change getResults method from tutorial into(changed lines of code in red):

    public function getResults($searchCriteria = array()) {
        $start = ($this->request->getVar('start')) ? (int)$this->request->getVar('start') : 0;
        $limit = 1;   
        $context = singleton('myObj')->getCustomSearchContext();
        $records = $context->getResults($searchCriteria, null, array('start'=>$start,'limit'=>$limit));
        $allrecords = $context->getResults($searchCriteria);
        if($records) {
        $records = new PaginatedList($records, $this->request);
        $records->setPageStart($start);
          $records->setPageLength($limit);
        $records->setTotalItems(count($allrecords));
        }
        return $records;
       }

    What's wrong?

    Thanks in advance for help.

  • longy
    Avatar
    Community Member
    5 Posts

    Re: ss 3.0.2 timed out session on reload search results Link to this post

    There is a way to solve using 'post' method (without disabling security token)?

    At the moment solved using:

    $form->setMethod('get');

    377 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.