Jump to content

possible to phase a define in variables


Death_Octimus

Recommended Posts

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;

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!

 

:confused:

 

<?php 

//don't not work
echo $request['priority']; 

//works
echo priority_3; ?>

 

ifs its not possible then nevermind i'll find anther way :)

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']);

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.