Working with Global Variables


Posted on 16th Feb 2014 07:03 pm by admin

hi, I'm not really sure why the following code is returning a "Call to a member function getBanners() on a non-object" error message.

Code:
var $_model;

function display ($tpl=null)
{
$this->_model = &$this->getModel();
global $option,$mainframe, $_model;

$Banners = $_model->getBanners();


$this->assignRef('Banners', $Banners);
parent::dislay($tpl);
}

if I replace "$Banners = $_model->getBanners();" with "$Banners = $this->_model->getBanners();" it works fine, I'm trying to shorten the code though.

No comments posted yet

Your Answer:

Login to answer
340 Like 15 Dislike
Previous forums Next forums
Other forums

Help =( !! Upload Pics [PHP script]
Hello
I need help with a php script [MULTIPLE UPLOAD IMAGES] , where I want to add a feature (wat

'grab_files', multiple extension?
hey guys,

can anyone suggest a way to make to following line of code look for files with more

calendar dates and hours compare problem
i have a calendar in wordpress, everything works great except that i can make 2 meetings at the same

pull content
I have an existing page, domain/adverts.php which has a good PR. I've just rebuilt my site and the n

Clean URLs
Hi I was wandering if anyone has ever implemented URLs on their PHP run website using URLS like wiki

Need help with basic sql
Hi,

I am using oracle 10g, and having some small doubts related to sql , here goes the si

Filtering for a phrase using pregmatch
Here is my code which looks for addresses which start with ' src=" '

Code: [Select]preg_

update post issues
I am trying to create an update to a post function, while the update does occur, the page routing an

Setting condidtions for an input box
Hi all,

I would like to set a condition in a txt box that says the number a user enters has t

creating a 1 to 100 in a table
hi guys I am a newb in php need some help.

I have a table with 1 column and 100 rows and in

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash