Jump to:

5539 Posts in 1738 Topics by 1224 members

Customising the CMS

SilverStripe Forums » Customising the CMS » $this->request->getVar() error in controller

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

Page: 1
Go to End
Author Topic: 1997 Views
  • nekranox
    Community Member
    31 Posts

    $this->request->getVar() error in controller Link to this post

    Hey guys,

    This looks like something really simple but I just can't figure it out.

    Front-end loads fine, dev/build works fine but when I try to go to admin I get:

    Fatal error: Call to a member function getVar() on a non-object in /mysite/code/Page.php on line 23

    Here's the offending function in Page.php:

       function BigFont() {
          $BigFont = $this->request->getVar('bigfont');
          if($BigFont == 'true') {
             return true;
          } else {
             return false;

    So it looks like I'm not accessing getVar properly. Strangely, it works on the front end of the site!

    Any ideas?

  • rob.s
    Community Member
    78 Posts

    Re: $this->request->getVar() error in controller Link to this post


    are you using ->getVar() in your Page class or Page_Controller class?

    If it's in Page class, try


    If in Page_Controller, try



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.