Welcome Guest, Not a member yet? Register   Sign In
why can't I get base_url() to work ?
#1

[eluser]vincej[/eluser]
I'm quite flumixed, having worked with CI for the last year, now something as basic as creating a new project with a new base_url() I just can not get to work. I'm trying to call a css file. If I put the full url into the <link href > it works, but if I put base_url() in, it fails. I can not for the life of me see what I am doing wrong. I'm using a whole fresh new install of CI.

Any ideas ?



my config file is set:

Code:
$config['base_url']= 'http://localhost/myproject/';


my test page:

Code:
<!DOCTYPE html>
&lt;html&gt;
    &lt;head&gt;
        &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8"&gt;
        &lt;title&gt;test&lt;/title&gt;
        &lt;link href="&lt;?php echo base_url();?&gt;css/default.css" type="text/css" rel="stylesheet"
        
    &lt;/head>
    &lt;body&gt;
        <p class='test' >hello from line 15 no php </p>
        
       &lt;?php
      echo "<div class='test'> Hello World</div>";
        ?&gt;
    
    &lt;/body&gt;
&lt;/html&gt;

controller:

Code:
public function index()
{
  $this->load->view('test');  
}


#2

[eluser]sanir[/eluser]
hi,

Load url helper.

thanks,
Nasir Ranta





Theme © iAndrew 2016 - Forum software by © MyBB