Welcome Guest, Not a member yet? Register   Sign In
Is a stupid problem, but is a problem!
#1

[eluser]jem88[/eluser]
Hi, I'm a codeigniter's newbie, and, like the title, i've a stupid trouble. I can't link to the stylesheet, but only put the <style> tag into the code. How can I take the external css? I try with
<link rel="stylesheet" type="text/css" href="<?base_url();?> framework/application/css/style.css" media="screen, print" />
thanks!!
#2

[eluser]xerobytez[/eluser]
That looks like it should work just fine. Are you getting any errors? Perhaps a 404 from the web server. And have you loaded the URL helper?
#3

[eluser]PhilTem[/eluser]
You have

1) a whitespace in the URI to your stylesheet
2) not echo'ed the base_url();

Use

Code:
<link rel=“stylesheet” type=“text/css” href=”<?php echo base_url('framework/application/css/style.css'); ?>” media=“screen,print” />
#4

[eluser]jem88[/eluser]
thank you all for the answers,
xerobytez, I don't get any errors, no 404. But I don't load the URI helper, now I try.
PhilTem, I try with your code, but seems not working, I have a white page. Sad
#5

[eluser]CroNiX[/eluser]
The application directory is not the place for assets like images/css or js files. It is protected and not directly accessible from the url, and the same with the /system dir. Like you can't just browse to http://yoursite.com/application/controll...roller.php . You should move those to a publicly accessible directory, like in the root of your website - probably where your index.php file is located.

Code:
-public_html (document_root)
--/application
--/system
--/assets
----/css
------style.css
--index.php

Code:
<link rel=“stylesheet” type=“text/css” href=”<?php echo base_url('assets/css/style.css'); ?>” media=“screen,print” />


#6

[eluser]CroNiX[/eluser]
It's also important to know if you are using an htaccess file to remove index.php from the urls. If you do, you should post it as it might affect what I just said depending on how it's written.
#7

[eluser]jem88[/eluser]
[quote author="CroNiX" date="1359491836"]The application directory is not the place for assets like images/css or js files. It is protected and not directly accessible from the url, and the same with the /system dir. Like you can't just browse to http://yoursite.com/application/controll...roller.php . You should move those to a publicly accessible directory, like in the root of your website - probably where your index.php file is located.

Code:
-public_html (document_root)
--/application
--/system
--/assets
----/css
------style.css
--index.php

Code:
<link rel=“stylesheet” type=“text/css” href=”<?php echo base_url('assets/css/style.css'); ?>” media=“screen,print” />


[/quote]

I try change the css folder position, and put it in assets/css/. I also changed the href in the link, but the result doesn't change. it load the text, but not the css.
After, I have the file .htaccess, and I've modified it like the manual said, but, if I "activate" it, doesn't run nothing! So I've deactivate the index.php from the config.php file!
thank all you for patience! Smile
#8

[eluser]zykapratama[/eluser]
Code:
<link rel="stylesheet" href="<?= base_url(); ?>css/pencarian.css" type="text/css" />
[removed][removed]




Theme © iAndrew 2016 - Forum software by © MyBB