url helper not loading

#1
[eluser]richzilla[/eluser]
Has anybody else had this problem? the url helper seems not to be loading, ive autoloaded it however on the first call to the
Code:
base_url()
function, the message i get is about an undefiend constant:
Code:
A PHP Error was encountered

Severity: Notice

Message: Use of undefined constant base_url - assumed 'base_url'

Filename: global/header.php

Line Number: 10

base_urlassets/css/reset.css" />

As far as i can see, ive loaded everything as i normally do, yet it seems not to like the url helper. The rest of my code:

View:
Code:
<div class="container_12">
    <div class="grid_12">
        <img src="" alt="logo" />
        <h1>Hello</h1>
    </div>
    <div class="grid_2 nav">
        <a href="&lt;?php echo base_url(); ?&gt;index.php/hs" id="hs"><span>Health And Safety</span></a>
    </div>
    <div class="grid_2 nav">
        <a href="&lt;?php echo base_url(); ?&gt;index.php/elas" id="elas"><span>Employment Law Advisory Service</span></a>
    </div>

and the line from the autoload file:

Code:
$autoload['helper'] = array('date','url','file','typography');

Any help would be appreciated

Cheers

#2
[eluser]n0xie[/eluser]
[quote author="ricardino" date="1254337131"]
Code:
Message: Use of undefined constant base_url - assumed 'base_url'

Filename: global/header.php

Line Number: 10

base_urlassets/css/reset.css" />
[/quote]
Your error is in global/header.php not in the view. Do you include it?

If you echo the base_url() in a controller, does it work? (I'm betting it does...)

#3
[eluser]richzilla[/eluser]
Very odd, it does work directly from the controller. global/header.php is the view file, as far as i understood it once id autoloaded a library or helper it was available to any file in the application?

#4
[eluser]n0xie[/eluser]
[quote author="ricardino" date="1254338191"]
global/header.php is the view file[/quote]
It says it has an error with 'base_urlassets/css/reset.css" />'. Nowhere in the view file you supplied is there a mention of assets/css/reset.css ergo you are probably either showing us the wrong view, or are editing the wrong file

#5
[eluser]richzilla[/eluser]
Apologies, helps if i post the whole thing:
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

&lt;html &gt;
&lt;head&gt;

    &lt;!---&lt;title&gt;&lt;?php echo $pgTitle; ?&gt;&lt;/title&gt;---&gt;
    
    &lt;link rel="stylesheet" type="text/css" href="&lt;?php echo base_url; ?&gt;assets/css/reset.css" /&gt;
    &lt;link rel="stylesheet" type="text/css" href="&lt;?php echo base_url; ?&gt;assets/css/text.css" /&gt;
    &lt;link rel="stylesheet" type="text/css" href="&lt;?php echo base_url; ?&gt;assets/css/960.css" /&gt;
    &lt;link rel="stylesheet" type="text/css" href="&lt;?php echo base_url; ?&gt;assets/css/override.css" /&gt;
    
    
    [removed][removed]
    [removed][removed]
    [removed][removed]
    
    &lt;!---&gt;&lt;?php foreach ($meta as $metatag) { echo $metatag; } ?&gt;<---&gt;
&lt;/head&gt;

<div class="container_12">
    <div class="grid_12">
        <img src="" alt="logo" />
        <h1>Hello</h1>
    </div>
    <div class="grid_2 nav">
        <a href="&lt;?php echo base_url(); ?&gt;index.php/hs" id="hs"><span>Health And Safety</span></a>
    </div>
    <div class="grid_2 nav">
        <a href="&lt;?php echo base_url(); ?&gt;index.php/elas" id="elas"><span>Employment Law Advisory Service</span></a>
    </div>
    <div class="grid_2 nav">
        <a href="&lt;?php echo base_url(); ?&gt;index.php/cdm" id="cdm"><span>Construction Design And Management</span></a>
    </div>
    <div class="grid_2 nav">
        <a href="&lt;?php echo base_url(); ?&gt;index.php/itserv" id="itserv"><span>IT Services</span></a>
    </div>
    <div class="grid_2 nav">
        <a href="&lt;?php echo base_url(); ?&gt;index.php/training" id="training"><span>Training</span></a>
    </div>
    <div class="grid_2 nav">
        <a href="&lt;?php echo base_url(); ?&gt;index.php/contact" id="contact"><span>Contact Us</span></a>
    </div>

#6
[eluser]n0xie[/eluser]
Replace base_url for base_url().

It's not a constant but a function.

#7
[eluser]richzilla[/eluser]
Fantastic thanks for the help. Its amazing the mistakes you manage to miss yourself.

cheers


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.