Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+1 vote
336 views
in Q2A Core by

I want to save some theme options inside qa_html_theme class, so user can easily set them by editing qa-theme.php .

something like:

    class qa_html_theme extends qa_html_theme_base
    {
    var $twitterID = "towhidn";

        function sidepanel()
        {
            $this->output('<DIV CLASS="qa-sidepanel">');

            $this->widgets('side', 'top');
            $this->sidebar();
            $this->feed();
            
            $this->output('<DIV CLASS="qa-twitter">');

            $this->get_tweets($twitterID);

            $this->output('</DIV>');
            
            $this->widgets('side', 'high');
            $this->nav('cat', 1);
            $this->widgets('side', 'low');
            $this->output_raw(@$this->content['sidepanel']);
            $this->widgets('side', 'bottom');
            $this->output('</DIV>', '');
        }

  }

 

my knowledge of PHP and extends classes failed me, here is the errors that i got :

Notice: Undefined variable: twitterID >>> on definning variable
Fatal error: Cannot access empty property >>> using it inside function

1 Answer

+1 vote
by
selected by
 
Best answer

Inside classes you need to refer to the class variables as $this->variable. So in your case it would be

$this->get_tweets($this->twitterID);

by
damn, I used $this->$twitterID before. thanks Scott.
...