Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6219113
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T07:43:27+00:00 2026-05-24T07:43:27+00:00

I want to use the constants.php file to store common image locations. I have

  • 0

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; ?>

I know that I can’t put:

$this->config->item('base_url')

in the constants file (I tried it, it errored out) and I tried:

$config('base_url')

which said it wasn’t defined. Here’s what I’d like to put in my constants file (even though I know this doesn’t work) so if you could help me, I’d appreciate it:

define('DB_IMG',$this->config->item('base_url').'/images/database.png');

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T07:43:27+00:00Added an answer on May 24, 2026 at 7:43 am

    Because constants.php is in the config directory it doesn’t have access to config items because config.php hasn’t been loaded yet. I think you’ll need to put the full URL in there or else use native PHP functions to get the base URL.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So I have a PHP file that I use to define all my constants
I want use a single php file to handle all of my voting requests.
I want to store image on mysql database by php as blob type, but
Currently I have a file called hits.php and on any page I want to
I want to use a new file containing constants in Codeigniter so I created
i want use some data from a website with web service. i have a
I use the same constant in all my php files. I do not want
OK, I have defined a PHP constant that points to a file on the
So, ok. I have many php files and one index.php file. All files can't
I have successfully setup an HTML form in PHP File #1, and it is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.