How to create a default css file for CI? - 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 create a default css file for CI? (/showthread.php?tid=21615) |
How to create a default css file for CI? - El Forum - 08-15-2009 [eluser]Shaheer[/eluser] Hello, this is my first day at CI. i was creating a sample page and i succeed. But when i tried to add a css file it failed. I put the same css file in Views folder and System and main htdocs but it just didn't got attached. Can any one help? Sorry for my English How to create a default css file for CI? - El Forum - 08-15-2009 [eluser]tomcode[/eluser] Welcome to CI . Using CI You should always use absolute URL's for assets( CSS, images, links), since depending on Your controller the page URL changes. There are several possibilities, read the user guide. In Your case use base_url() from either the url helper or the config class. How to create a default css file for CI? - El Forum - 08-15-2009 [eluser]Shaheer[/eluser] thanks for reply. can you post the link to that page of user guide. i haven't covered CI completely yet i am using a book. so i didn't yet understand about that base_url thing. Please help. How to create a default css file for CI? - El Forum - 08-15-2009 [eluser]tomcode[/eluser] http://ellislab.com/codeigniter/user-guide/helpers/url_helper.html http://ellislab.com/codeigniter/user-guide/libraries/config.html, fetching config items How to create a default css file for CI? - El Forum - 08-15-2009 [eluser]Slowcheetah[/eluser] i use Code: <link href= "<?php echo base_url(); ?>assets/css/master.css" rel="stylesheet" type="text/css" /> And place my css: codigniter_installation/assets/css/master.css How to create a default css file for CI? - El Forum - 08-15-2009 [eluser]tomcode[/eluser] Where do You have You index.php ? webroot/index.php webroot/codigniter_installation/index.php The base_url always starts where Your index.php is. How to create a default css file for CI? - El Forum - 08-16-2009 [eluser]Shaheer[/eluser] it still doesn't work i have placed the style.css file in the same folder as index.php but no changes below is the view file <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html > <head> <link rel="stylesheet" href="<?php echo base_url(); ?>style.css" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Web Test Site</title> </head> <body> <h1><?php echo $mytitle; ?></h1> <p class="test"> <?php echo $mytext; ?> </p> <?php echo $base ?> </body> </html> $base and other vars are passed by control. How to create a default css file for CI? - El Forum - 08-16-2009 [eluser]Slowcheetah[/eluser] What output has the folowing code? Code: <?php echo base_url(); ?> How to create a default css file for CI? - El Forum - 08-16-2009 [eluser]tomcode[/eluser] Check the resulting HTML code ... How to create a default css file for CI? - El Forum - 08-16-2009 [eluser]Shaheer[/eluser] first it was http://www.example.com/ then i modified it to http://localhost. is the problem with that? |