CodeIgniter Forums
Help please! - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: Help please! (/showthread.php?tid=37050)



Help please! - El Forum - 12-25-2010

[eluser]Unknown[/eluser]
Hi everybody, and Merry Christmas !

I wish someone could help me please, i have a weird problem : i write <?php $this->config->item('base_url'); ?> in my view, and nothing is displayed, as you can see on this page : http://test.ownsurf.com/.

Yesterday i was having the same problem, the same view, from the same controller, but not the same function.

<?php

function index()
{

$this->load->view('header');

}
function ref()
{

$this->load->view('header');

}

From the function index, the base_url variable was correct, but from the ref function, no ...

If someone have had the same problem previously, and fixed it, please help me, thanks!!


Help please! - El Forum - 12-25-2010

[eluser]Unknown[/eluser]
Hi ownAks and Merry Christmas,

You are doing a small mistake which I do all the time Smile

Code:
<?php $this->config->item(‘base_url’); ?>

You forgot to use echo

Code:
<?php echo $this->config->item(‘base_url’); ?>

Hope this helps Wink


Help please! - El Forum - 12-25-2010

[eluser]InsiteFX[/eluser]
Load the url_helper

Code:
<?php echo base_url(); ?>

//EXAMPLE:
<base href="<?php echo base_url(); ?>">

InsiteFX


Help please! - El Forum - 12-25-2010

[eluser]Unknown[/eluser]
OMG Yes it works !!! thank you very much, of course if i forgot the "echo" ...