frozenmafia Posted June 9, 2010 Share Posted June 9, 2010 Thanks pal but now I get: Fatal error: Using $this when not in object context in /home/frozen01/public_html/classeswgradients.php on line 777. 776 /*** a line of text ***/ 777 $text = $this->username; Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted June 9, 2010 Share Posted June 9, 2010 Using $this when not in object context You cannot use $this-> unless you are in a class/object. Is the code you posted part of a class? Quote Link to comment Share on other sites More sharing options...
frozenmafia Posted June 9, 2010 Author Share Posted June 9, 2010 yeah it is in a classes.php where everything works off. It works everywhere else in the code Quote Link to comment Share on other sites More sharing options...
Psycho Posted June 9, 2010 Share Posted June 9, 2010 yeah it is in a classes.php where everything works off. It works everywhere else in the code That really doesn't answer the question. Just because the file is named classes.php doesn't mean anything. Is that line in a properly declared CLASS. Example: <?php class Time { var $sTime; function GenerateCurrentTime(){ $this->sTime = gmdate("d-m-Y H:i:s"); return $this->sTime; } } ?> Quote Link to comment Share on other sites More sharing options...
frozenmafia Posted June 9, 2010 Author Share Posted June 9, 2010 in that case, no it isn't other than username been declared BEFORE the function and it works everywhere else. Quote Link to comment Share on other sites More sharing options...
Alex Posted June 9, 2010 Share Posted June 9, 2010 Post your code. Quote Link to comment Share on other sites More sharing options...
Daniel0 Posted June 9, 2010 Share Posted June 9, 2010 Quote Link to comment Share on other sites More sharing options...
frozenmafia Posted June 9, 2010 Author Share Posted June 9, 2010 ok [attachment deleted by admin] Quote Link to comment Share on other sites More sharing options...
Alex Posted June 9, 2010 Share Posted June 9, 2010 As suspected, your problem is a scope problem. You're trying to use $this inside of the gradient function, it is not defined there. Read about variable scopes here. Why are you even using OOP in the first place? You're not using it in any way shape or form that would give you an advantage. It's a horrible implementation, all you're doing is packing everything inside the constructor of the object. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.