Death_Octimus Posted February 23, 2010 Share Posted February 23, 2010 is it possible to phase a define in variables probley easy lol! just can't find a way define("priority_3","<span class=\"priority_3\">Normal</span>", ture); <?php echo $request['priority']; ?> Link to comment https://forums.phpfreaks.com/topic/193065-possible-to-phase-a-define-in-variables/ Share on other sites More sharing options...
Death_Octimus Posted February 23, 2010 Author Share Posted February 23, 2010 would BB code code be a good way forward? Link to comment https://forums.phpfreaks.com/topic/193065-possible-to-phase-a-define-in-variables/#findComment-1016758 Share on other sites More sharing options...
KevinM1 Posted February 23, 2010 Share Posted February 23, 2010 I think I speak for everyone here when I say I don't know what you're asking. A better explanation of what you're trying to do, with relevant context, may make it easier for you to get help. Link to comment https://forums.phpfreaks.com/topic/193065-possible-to-phase-a-define-in-variables/#findComment-1016765 Share on other sites More sharing options...
Death_Octimus Posted February 23, 2010 Author Share Posted February 23, 2010 sorry peeps basically I got a var = $request['priority']; whats prints out " priority_3 " want this to work \/ define("priority_3","<span class=\"priority_3\">Normal</span>", ture); Link to comment https://forums.phpfreaks.com/topic/193065-possible-to-phase-a-define-in-variables/#findComment-1016768 Share on other sites More sharing options...
jay7981 Posted February 23, 2010 Share Posted February 23, 2010 so what you are wanting is .. <?php IF ($request==priority_3){ echo "something here"; }elseif ($request==priority_2{ echo "this instead"; }else{ echo "this too"; } ?> Link to comment https://forums.phpfreaks.com/topic/193065-possible-to-phase-a-define-in-variables/#findComment-1016870 Share on other sites More sharing options...
Death_Octimus Posted February 23, 2010 Author Share Posted February 23, 2010 no I need to call a define from a var ! Link to comment https://forums.phpfreaks.com/topic/193065-possible-to-phase-a-define-in-variables/#findComment-1016932 Share on other sites More sharing options...
eli312 Posted February 23, 2010 Share Posted February 23, 2010 define("priority_3","<span class=\"priority_3\">Normal</span>", ture); should be: define("Priority_3","<span class=\"priority_3\">Normal</span>", true); then: define("Priority_3","<span class=\"priority_3\">Normal</span>", true); echo Priority_3; Link to comment https://forums.phpfreaks.com/topic/193065-possible-to-phase-a-define-in-variables/#findComment-1016937 Share on other sites More sharing options...
wildteen88 Posted February 23, 2010 Share Posted February 23, 2010 You need to be more specific with your question. no I need to call a define from a var ! Does not make sense. Do you know what define does and how to use constants. Link to comment https://forums.phpfreaks.com/topic/193065-possible-to-phase-a-define-in-variables/#findComment-1017013 Share on other sites More sharing options...
Death_Octimus Posted February 23, 2010 Author Share Posted February 23, 2010 okay i have the define in my themefile /images/default/theme.php okay thats all good it will work if called right form a php file in an echo in "words" echo priority_3; BUT I'm trying to pull the words form an $request['priority']; containing the same words! <?php //don't not work echo $request['priority']; //works echo priority_3; ?> ifs its not possible then nevermind i'll find anther way Link to comment https://forums.phpfreaks.com/topic/193065-possible-to-phase-a-define-in-variables/#findComment-1017021 Share on other sites More sharing options...
wildteen88 Posted February 23, 2010 Share Posted February 23, 2010 Do you mean $request['priority'] holds the value 'priority_3' (or priority_2 or priority_1 etc). And you want to call the constand priority_3 (or 2 or 1 etc). You can use the function constant to call a constant For example define("Priority_3","<span class=\"priority_3\">Normal</span>", true); $request['priority'] = 'Priority_3'; echo constant($request['priority']); Link to comment https://forums.phpfreaks.com/topic/193065-possible-to-phase-a-define-in-variables/#findComment-1017037 Share on other sites More sharing options...
KevinM1 Posted February 23, 2010 Share Posted February 23, 2010 Also, do you have your own array named $request, or are you trying to use the superglobal array $_REQUEST? Link to comment https://forums.phpfreaks.com/topic/193065-possible-to-phase-a-define-in-variables/#findComment-1017039 Share on other sites More sharing options...
Death_Octimus Posted February 23, 2010 Author Share Posted February 23, 2010 ty wildteen88 I new it had to be simple.... sorry for the mass confusion!! Nightslyr : its my own request form an mysql query. but it works now tyvm. sorry again. Link to comment https://forums.phpfreaks.com/topic/193065-possible-to-phase-a-define-in-variables/#findComment-1017042 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.