CodeIgniter Forums
Loss of design with a parameter in the route [CI4] - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: Best Practices (https://forum.codeigniter.com/forumdisplay.php?fid=12)
+--- Thread: Loss of design with a parameter in the route [CI4] (/showthread.php?tid=78184)



Loss of design with a parameter in the route [CI4] - MbraOliver - 12-10-2020

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        


RE: Loss of design with a parameter in the route [CI4] - vitnibel - 12-11-2020

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.


RE: Loss of design with a parameter in the route [CI4] - MbraOliver - 12-12-2020

(12-11-2020, 12:56 AM)vitnibel Wrote: 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.
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.


RE: Loss of design with a parameter in the route [CI4] - vitnibel - 12-14-2020

Hi.
No config files need to be changed in this case. The .env file has priority over the configs files.


RE: Loss of design with a parameter in the route [CI4] - demyr - 12-14-2020

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.