I-AM-OBODO Posted March 19, 2012 Share Posted March 19, 2012 Hi, I created a css folder for all my styles, when i link the style on my editor i can see the style output but on the browser the style does not reflect. why is it so? what can i do to make it reflect. thank you Quote Link to comment https://forums.phpfreaks.com/topic/259260-css-not-working-in-codeigniter/ Share on other sites More sharing options...
AyKay47 Posted March 19, 2012 Share Posted March 19, 2012 Can you show us an example. Quote Link to comment https://forums.phpfreaks.com/topic/259260-css-not-working-in-codeigniter/#findComment-1329061 Share on other sites More sharing options...
I-AM-OBODO Posted March 19, 2012 Author Share Posted March 19, 2012 Can you show us an example. my folder structure: application, css, images, js, system (index.php) on my view i have a file service.php and i attached a style <link href="../../css/styles.css" rel="stylesheet" type="text/css"> on my editor, i could see the effects of my styles but when i view in browser, no effects thanks Quote Link to comment https://forums.phpfreaks.com/topic/259260-css-not-working-in-codeigniter/#findComment-1329071 Share on other sites More sharing options...
I-AM-OBODO Posted March 19, 2012 Author Share Posted March 19, 2012 hi. after some gogling i finally figured it out. thanks all Quote Link to comment https://forums.phpfreaks.com/topic/259260-css-not-working-in-codeigniter/#findComment-1329177 Share on other sites More sharing options...
Mahngiel Posted March 19, 2012 Share Posted March 19, 2012 What I do with CI is set up an autoloading model (config/autoload.php) with all my constants, so things like the site's name, full url paths for images, css, ans JS, and so on. Example: class Constants extends CI_Model { public $CI; /** * Constructor * */ function __construct() { // Call the Model constructor parent::__construct(); // Create an instance to CI $CI =& get_instance(); // Load the settings, users & session models $CI->load->model('Settings_model', 'settings'); $CI->load->model('Users_model', 'users'); $CI->load->model('Session_model', 'user'); // Define frequently used settings define('SITE_NAME', $this->get_setting('site_name')); define('ADMIN', 'admin/'); define('ADMIN_URL', base_url() . 'app_path/views/' . ADMIN); define('FILES', '/var/www/path/to/app_path/files'); //full path to folder OUTSIDE of CMS application directory define('IMAGES', base_url() . 'app_path/views/images/'); define('UPLOAD', 'app_path/views/images/'); define('CSS', 'app_path/css/'); } Then when you're using your frequent functions, you can do: // quick link to CSS <?php echo link_tag(CSS . 'style.css'); ?> // quick link for admin shtuff <?php echo anchor(ADMIN . 'home', 'Admin Panel'); ?> // regular linkage <?php echo anchor('reviews/unread', 'Unread Reviews'); ?> Quote Link to comment https://forums.phpfreaks.com/topic/259260-css-not-working-in-codeigniter/#findComment-1329182 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.