CodeIgniter Forums
CodeIgniter and PHP - 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: CodeIgniter and PHP (/showthread.php?tid=31430)



CodeIgniter and PHP - El Forum - 06-18-2010

[eluser]Blues Clues[/eluser]
Hello
I am exploring CI and PHP and wondering if I could include PHP code snippets in <head> tag of HTML code...

for example, I have the following code in <head>.
<!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;?php echo base_url(); ?&gt;
&lt;/head&gt;

&lt;body&gt;
<ul>
<li><a href="#">Home</a></li>
</ul>
&lt;/body&gt;

Any thoughts as to why I would not get any results. My page is blank.


-BC


CodeIgniter and PHP - El Forum - 06-18-2010

[eluser]danmontgomery[/eluser]
You have to load the URL helper in order to use it's functions.

http://ellislab.com/codeigniter/user-guide/helpers/url_helper.html


CodeIgniter and PHP - El Forum - 06-19-2010

[eluser]Blues Clues[/eluser]
Hi
I already have the following stmt in my autoload.php



$autoload['helper'] = array('url');


Should I have something more added in addition to this?


CodeIgniter and PHP - El Forum - 06-20-2010

[eluser]InsiteFX[/eluser]
Code:
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
&lt;html &gt; wrong you have a space here

it should be this
&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;

&lt;head&gt;
&lt;?php echo base_url(); ?&gt; this will only showup in source view not on screen
&lt;/head&gt;

&lt;body&gt;
<ul>
<li>Home</li>
</ul>
&lt;/body&gt;
no ending &lt;/html&gt; tag

Also this I hope you are displaying in a view file.

InsiteFX