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.

340 Like 15 Dislike
Previous php-forum Next php-forum
Other php-forum

PHP Session Issue
I'm having an issue with one section on my website dealing with sessions. Now I know that myself and

Seperate team from score
I am writing a site that does a NFL Pick 'em type application and I have a feed that gives me the sc

How to search for several parameters from objects in a database?
I have a database with lots of information about objects.
Now I would like to search for 4 or 5 p

question about header() security
is is safe to just use the header() function to redirect someone if they are, say, not logged in? or

Add a sign-up feature to a flat file login script
I'm working on a flat file login script and I would like to add a sign-up feature to it with a email

How could I do this?
Ive got a simple lottery game, and am using an sql database to keep track of the numbers bought. But

please hep to get values from a table row
can anyone tel me how I can select and get data from one row by pressing an Edit button in that row

registration form
first time posting. did some searches but didnt find exactly what i am looking for. dont flame cause

Email Script does not reach destination
Hey Guys look at this code snippet :
Code:
//read a line from the file

$myFile = "

Help with forum quoting?
Hi im working on a forum and I have alomost finished it but i want a user quote system like twitter

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