css are not loading |
Hello,
I wonder why the css files are not loading? views/index.php <link rel="stylesheet" href="<? echo base_url('assets/css/style.css'); ?>"> <link rel="stylesheet" href="<? echo base_url('assets/css/custom.css'); ?>"> config.php $config['base_url'] = 'http://localhost/coolcicms/'; File location: coolcicms/assets/css/style.css coolcicms/assets/css/custom.css I already autoload the url helpder.
" If I looks more intelligence please increase my reputation."
In the Network Tab
Request URL: http://localhost/coolcicms/index.php/<? echo base_url('assets/css/style.css'); ?> Request Method: GET
" If I looks more intelligence please increase my reputation."
I think I am going to post the solution that I discovered.
<?php echo base_url('assets/css/style.css'); ?>
" If I looks more intelligence please increase my reputation."
(05-05-2018, 06:30 AM)davy_yg Wrote: Hello, Use this: <link rel="stylesheet" href="<?= echo base_url('assets/css/style.css'); ?>"> <link rel="stylesheet" href="<?= echo base_url('assets/css/custom.css'); ?>"> "<?" does not mean "echo" or "print" but "<?=" does
@BobM: Now you got double echo. <?= echo means <?php echo echo.
<? are shorthand for <?php if you have activated it. So it works on some systems.
"<? are shorthand for <?php if you have activated it. "
How to activated it?
" If I looks more intelligence please increase my reputation."
It should be like this:
PHP Code: <link rel="stylesheet" href="<?= base_url('assets/css/style.css'); ?>"> And this is why they say do not use SHORT OPEN TAGS... What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
Guys I'm having the same problem.
My code in my view file. <link rel="stylesheet" href="<?= base_url('bootstrap/css/bootstrap.min.css'); ?>" type="text/css"> The bootstrap assets are in a folder called bootstrap at the same level as the application folder. /path/to/web/root/ ├── application/ └── views/ ├── templates ├── header.php ├── footer.php ├── system/ ├── bootstrap/ rendered output <link rel="stylesheet" href="http://localhost/codeigniter/bootstrap/css/bootstrap.min.css" type="text/css"> I've tried different locations within the project, nesting it in the application folder and under views but with the same non result even thought the path always seems to correct in relation to the local folder structure. Trying to access the css files directly through the browser generates a 404? If I link to external css files they load fine. What esoteric thing could be going on here? I've spent a nearly a day on this and its driving me insane. I've got myself ready for a massive face palm. TIA |
Welcome Guest, Not a member yet? Register Sign In |