2

This line keeps giving me the aforementioned error:

<img style="padding:10px; margin:auto; display:block;" <?php echo 'src="' . base_url("assets/images/email/mailheader.jpg") . '"' ?>>

I'm running this on xampp and can't seem to figure it out, any help would be greatly appreciated.

4
  • 1
    Have you defined a base_url() function? Commented Feb 17, 2014 at 16:21
  • stackoverflow.com/questions/6449386/… Commented Feb 17, 2014 at 16:21
  • Yes, $autoload['helper'] = array('common_functions', 'form', 'url'); is present in autoload.php and the function works when called from other view files, just not this one for some reason. Commented Feb 17, 2014 at 16:34
  • how is this view different than the other views? can you post the code from one where it works? are there different controllers? Commented Feb 17, 2014 at 18:19

2 Answers 2

4

You need to load the URL helper

$this->load->helper('url');
Sign up to request clarification or add additional context in comments.

4 Comments

$autoload['helper'] = array('common_functions', 'form', 'url'); is already present in autoload.php
Can you also include the code I added, at the beginning of the view?
doing so results in Fatal error: Using $this when not in object context
are you using it in a helper function? probably you have not extended the codeigniter controller... Use $CI = get_instance(); For older versions of php, use =& Then, use $CI wherever you would normally use $this
3

You need to write

 public function __construct() {
   parent::__construct();
   $this->load->helper('url');
}

In your controller and then use in your view

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.