Loss of design with a parameter in the route [CI4] |
Hello. I have a problem with version 4 of Codeigniter. I understood the routes correctly, but I have a problem sending them parameters. When my road is simple; everything works fine. However, as soon as I add a parameter to it, I lose the design of my page. I can no longer access my css and js files. Someone can help me?
Attachment.. File AA : With simple url File BB : Url with params
Hi.
Most often this is due to incorrect $baseURL parametr in app/Config/App.php. Show what you specified in this parameter and what url you get to load the stylesheet in the page header with and without a parameter.
(12-11-2020, 12:56 AM)vitnibel Wrote: Hi.Hello, I have configured the site with the .env file, do I still have to modify the config file? Initially I didn't insert the base url in my links, now that I have done that everything is working fine.
Hi.
No config files need to be changed in this case. The .env file has priority over the configs files.
Basing on the base_url() you can handle it:
For example, CSS: <link rel="stylesheet" href="<?php echo base_url('assets/css/backend.css');?>?ver=<?php echo time();?>"> JS: <script src="<?php echo base_url('assets/js/example-folder/example.js');?>" ></script> // time function at the end of css file is to overcome cahce issue. Otherwise, you might not see the latest changes you have made on the css file. |
Welcome Guest, Not a member yet? Register Sign In |