CodeIgniter Forums
Problem with HTML helper - 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: Problem with HTML helper (/showthread.php?tid=11128)

Pages: 1 2


Problem with HTML helper - El Forum - 08-27-2008

[eluser]jbrozz[/eluser]
Hello, I have a big simple problem with HTML helper.

My problem is include the CSS layout file and images; for example, in views directory there are:

test.php
css/
- layout.css
images/
- banner.jpg

in controller I have includes the html helper $this->loader->helper('html'); Ok!
In test.php (views directory) the HTML code is:

<link rel="styleshett" href="css/layout.css" />

But the system engine doesn't include my css file and my images!!!!

Did you help me? Smile

PS. sorry for bad english, but I'm italian Smile


Problem with HTML helper - El Forum - 08-27-2008

[eluser]andreagam[/eluser]
Hi Jbrozz,

did you write it like that?
Code:
<link rel="styleshett" href="css/layout.css" />

If so, it's not correct.
Change "styleshett" in "stylesheet"


bye


Problem with HTML helper - El Forum - 08-27-2008

[eluser]andreagam[/eluser]
Wait Jbrozz,

where did you put your css and images folders?
They should not be in the view folder, but in the root (same level as index.php)
Or, if you put them in the view folder, change the relative path accordingly.

Hope it helps.
Quote:Did you help me? Smile

Yes, I did ;-)


Problem with HTML helper - El Forum - 08-27-2008

[eluser]jbrozz[/eluser]
Thanks for reply.

Sorry for error, double T is not correct Wink

I put my css folder with images and css style files into /views and into /root, but... nothing! Smile
The result not change!

Help me Sad


Problem with HTML helper - El Forum - 08-27-2008

[eluser]jbrozz[/eluser]
So...

for includes my css style, I use:

link_tag('css/main.css');

But the result not change :S


Problem with HTML helper - El Forum - 08-27-2008

[eluser]andreagam[/eluser]
Have a look at the Html code resulting, so you'll see where the page is looking for the files...
If you want, copy/paste the <head> tag so maybe we can help more...


Problem with HTML helper - El Forum - 08-27-2008

[eluser]jbrozz[/eluser]
this is my source html code (portfolio.php) in views/

<!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;meta http-equiv="Content-type" content="text/html; charset=utf-8" /&gt;
&lt;link rel="stylesheet" href="css/main.css" /&gt;

&lt;/head&gt;
&lt;body&gt;
<h1>&lt;?=$title?&gt;</h1>

&lt;/body&gt;
&lt;/html&gt;

is a simple HTML page for testing HTML template.

css/main.css is put on /root, where there is index.php.

But doesn't load css styleshet :S


Problem with HTML helper - El Forum - 08-27-2008

[eluser]jbrozz[/eluser]
with link_tag(); function the source code is:

&lt;link href="http://localhost/css/main.css" rel="stylesheet" type="text/css" /&gt;

but, nothing...


Problem with HTML helper - El Forum - 08-27-2008

[eluser]jbrozz[/eluser]
wait wait...

without the .htaccess file... function! Where is the problem? O_o


Problem with HTML helper - El Forum - 08-27-2008

[eluser]jbrozz[/eluser]
Nothing, i have resolve this problem :S

i modify .htaccess file into:

RewriteEngine on
RewriteCond $1 !^(index\.php|images|css|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]

thanks all Smile