Welcome Guest, Not a member yet? Register   Sign In
How to use the base_url(); function? - problem solved
#1

[eluser]mathew edison[/eluser]
Problem solved, my FTP client wasn't uploading properly -.-

Right I'm new to CodeIgniter and I'm loving it so far. I got a question about the base url function though because I'm using it like in the user guide however if I echo it the results on the page says "array" I was wondering how I could fix this.

Controller:
Code:
<?php

class Home extends Controller {

    function Home()
    {
        parent::Controller();    
    }
    
    function index()
    {
        $this->load->helper('url');
        $this->load->view('welcome_message');
    }
}

/* End of file welcome.php */
/* Location: ./system/application/controllers/welcome.php */

View file:
Code:
<?php

echo base_url();

?>

sincerely
- Mathew
#2

[eluser]Randy Casburn[/eluser]
Look at the attached picture. Anything marked (readonly) is a global variable you can access from your scripts. So <?php echo BASEPATH ?> should work.

Randy
#3

[eluser]Randy Casburn[/eluser]
Or the normal convention works too. Smile

Randy
#4

[eluser]mathew edison[/eluser]
@Randy: Thanks for the reply. I found the problem initially but this way is even easier cause I won't have to load the helper. Next time i'll check if notepad ++ is actually uploading my stuff before I post here Big Grin




Theme © iAndrew 2016 - Forum software by © MyBB