![]() |
how to insert a css on codeingiter - 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: how to insert a css on codeingiter (/showthread.php?tid=29287) |
how to insert a css on codeingiter - El Forum - 04-05-2010 [eluser]Unknown[/eluser] Hi all, I'm Steven and is a first to approacing a codeigniter. I have a problem to insert a external css in to a file php, I create a file css and i wirite a code for recall him (<link rel="stylesheet" href='css/style.css' type="text/css" media="screen" /> ![]() I'm looking more topic to recall the css but more topic speaking for a file .htaccess for resolve this problem. Can you help me? Thank you guys. how to insert a css on codeingiter - El Forum - 04-05-2010 [eluser]adamp1[/eluser] CodeIgniter has nothing to do with the CSS. Your css files will be handled in the html. The example you gave there is using a relative URL, have you tried an absolute url instead? how to insert a css on codeingiter - El Forum - 04-05-2010 [eluser]Unknown[/eluser] Today I try. thank you. how to insert a css on codeingiter - El Forum - 04-05-2010 [eluser]Mischievous[/eluser] Welcome to CodeIgniter community Stelab! If your CSS is located anywhere inside your site root you must specify where its located in your .htaccess file Code: RewriteEngine on *Note: look at the last part of the second line of code "|css" should be where ever your css is located or if you put it in your root it should be your "|css\.css" Also when loading your css in a view be sure to load up the url helper and run <?=base_url()?> to get your absolute path incase you change the base url in your config file you dont have to go through all your view files to change! ![]() how to insert a css on codeingiter - El Forum - 04-05-2010 [eluser]evolutionxbox[/eluser] You could also try: Code: <link rel=“stylesheet” href=‘<?=base_url()?>css/style.css’ type=“text/css” media=“screen” />) how to insert a css on codeingiter - El Forum - 04-07-2010 [eluser]tanero[/eluser] Your base url value in your application/config/config.php file. Also , css , image and other public materials must be in your public webroot. When you setup your view file base_url() will show your public root. Codeigniter will not access directly. Your rendered html will access it. how to insert a css on codeingiter - El Forum - 04-07-2010 [eluser]matula[/eluser] Is there anyway to access the CSS through CI if the CSS directory is in the 'application' directory? In my case, I have the application dir outside of the system dir, and then in Eclipse, I'm using the application dir as my project folder. When I put the CSS dir in the root, it works fine... but I'm not able to access/edit it directly in Eclipse. It could be an htaccess issue, but I'm not versed enough to know how to change it. Any thoughts? Thanks. how to insert a css on codeingiter - El Forum - 04-07-2010 [eluser]Mischievous[/eluser] Hey Metula use this -> RewriteCond $1 !^(index\.php|templates|media|robots\.txt|css|system/application/css) when you want to allow access to a folder or file simply add another " | " and then type your directory in. If your trying to allow access to a file escape the dot with a backslash. how to insert a css on codeingiter - El Forum - 04-07-2010 [eluser]matula[/eluser] perfect... thanks! how to insert a css on codeingiter - El Forum - 05-05-2010 [eluser]tanero[/eluser] [quote author="Mischievous" date="1270677977"]Hey Metula use this -> RewriteCond $1 !^(index\.php|templates|media|robots\.txt|css|system/application/css) when you want to allow access to a folder or file simply add another " | " and then type your directory in. If your trying to allow access to a file escape the dot with a backslash.[/quote] Warning , it is not a good habit to let system and apllication directories be accessible from public. This is a securtiy warning. |