Zepo. Posted August 3, 2009 Share Posted August 3, 2009 Inside of a class I have a var var $template_dir ="./style/default/"; Say i want to make this var equal $def_dir, everything i tried gives me errors, is this possible to do? I've tried =$def_dir; ="$def_dir"; and none work. Quote Link to comment https://forums.phpfreaks.com/topic/168575-simple-var-question/ Share on other sites More sharing options...
.josh Posted August 3, 2009 Share Posted August 3, 2009 You cannot assign a variable to a property in the property declaration. Where in the flow of your script are you trying to assign this? Are you wanting to instantiate an object and pass an arbitrary value to $template_dir ? You can do something like this: class blah { var $template_dir = ''; function __construct($dir) { $this->template_dir = $dir; } } $something = new blah('some/random/path'); Quote Link to comment https://forums.phpfreaks.com/topic/168575-simple-var-question/#findComment-889217 Share on other sites More sharing options...
Zepo. Posted August 3, 2009 Author Share Posted August 3, 2009 Well what i'm using is a premade template engine (template lite) which has a class with the configuration var's in it. Instead of having ./style/default/ in the var I defined $def_dir as the same thing but it pulls from the database for easier configuration. I'm new with OOP so bare with me Quote Link to comment https://forums.phpfreaks.com/topic/168575-simple-var-question/#findComment-889219 Share on other sites More sharing options...
Zepo. Posted August 3, 2009 Author Share Posted August 3, 2009 I hate to go offtopic with this threat but another thing i've been having a problem with is reCaptcha. For some reason it wont send the variables. http://completeladders.com/development/v1/user.php Can anyone see something on that page that would be preventing it? It's driving me crazy. Quote Link to comment https://forums.phpfreaks.com/topic/168575-simple-var-question/#findComment-889301 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.