Welcome Guest, Not a member yet? Register   Sign In
Storing image locations using constants.
#1

[eluser]XstreamINsanity[/eluser]
I want to use the constants.php file to store common image locations. I have a menu and each item has an image of it's own, and currently for each image in the view, I have:

<?php echo $this->config->item('base_url'); ?>/images/database.png"/>

Or whatever the filename is. What I want to do is store a constant "DB_IMG" in this instance, and simply be able to say in my view:

<?php echo DB_IMG; ?>

One question I have is can I use the $this->config->item('base_url') inside the constants.php file? Secondly, is it a good practice to store image names as constants in a constants file? Thanks for all of the help.


Messages In This Thread
Storing image locations using constants. - by El Forum - 08-04-2011, 03:21 PM
Storing image locations using constants. - by El Forum - 08-04-2011, 10:50 PM
Storing image locations using constants. - by El Forum - 08-09-2011, 02:46 PM
Storing image locations using constants. - by El Forum - 08-09-2011, 07:57 PM
Storing image locations using constants. - by El Forum - 08-09-2011, 08:15 PM



Theme © iAndrew 2016 - Forum software by © MyBB