CodeIgniter Forums
base_url() bug? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: base_url() bug? (/showthread.php?tid=53852)



base_url() bug? - El Forum - 08-11-2012

[eluser]TuxLyn[/eluser]
Hey guys, today I've discovered this peace of code that don't work.
All the parser code seems to stop working when this following command is used.

Code that not working:
Code:
$data = array( 'base' => base_url() );

Code that works:
Code:
$data['base'] = base_url();

This is when template parser is used instead of regular ($this->load->view) command.
Code:
$this->parser->parse('page', $data);

Can some one please explain why this could be happening ? Is this a bug perhaps ?

Thank you.


base_url() bug? - El Forum - 08-11-2012

[eluser]Aken[/eluser]
If $data has not been defined yet, those two definitions are exactly the same.

If $data already has stuff in it, the first option will turn $data to a new array, with only the "base" key in it.

What exactly is not working?


base_url() bug? - El Forum - 08-11-2012

[eluser]TuxLyn[/eluser]
@Aken, I thought I've explained it above. I have no idea why its not working. $data was not previously set the code is exactly like above.


base_url() bug? - El Forum - 08-11-2012

[eluser]skunkbad[/eluser]
Show more code. We cant fully know what is going on without seeing it.


base_url() bug? - El Forum - 08-11-2012

[eluser]TuxLyn[/eluser]
Alright thanks for the help guys. I've ended up using smarty template instead. It supports switch.