Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Customising the CMS /

$this->request->getVar() error in controller


Reply


2 Posts   2133 Views

Avatar
nekranox

Community Member, 31 Posts

19 November 2010 at 12:56am

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?

Avatar
rob.s

Community Member, 78 Posts

22 November 2010 at 8:59pm

Edited: 22/11/2010 9:02pm

Hi,

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

If it's in Page class, try

Controller::curr()->getRequest()->getVar()

If in Page_Controller, try

$this->getRequest()->getVar()

Greetings,
Rob