This may be impossible, but I was wondering if its possible to output the content of a define using the value of a variable.
Like this:
define("SEO_HOME", "Home name");
$var="SEO_HOME";
echo $var
This will print off course “SEO_HOME”. How can I make it print “Home name” (using the variable $var)?
Edit: Corrected define.
Edit:
My all problem his, the site I’ll edit use defines to identify all pages, eg:
define("CONTACT_PAGE","Please contact us");
define("INFO_PAGE","Some information about us");
And I’ll need to add custom html title on those pages, that owner will be able to edit. So I was thinking I would create a DB table with (id, page, title) where page would have CONTACT_PAGE, INFO_PAGE, etc. and title would be the title itself.
Now to make an edit page for site owner, I’ll have this:
//This would be an while mysql_fetch_assoc and not a multidimentional array, but for example this will work
$titleArray=array(array("CONTACT_PAGE", "my title for contact page"),array("INFO_PAGE", "my title for info page"));
?>
<tr>
<td>Set title for: <?php echo $titleArray[0][0];?></td>
<td><input type="text" name="name" value="<?php echo $titleArray[0][1];?>" /></td>
</tr>
<tr>
<td>Set title for: <?php echo $titleArray[1][0];?></td>
<td><input type="text" name="name" value="<?php echo $titleArray[1][1];?>" /></td>
</tr>
This shows on first td -> Set title for: CONTACT_PAGE
And I wanted it to show -> Set title for: Please contact us
Hope this clarifies my doubt.
you can use constant function: