How to add React JS files in Codeigniter 4 Views while keeping js files in Views fold |
Also posted on stackoverflow: https://stackoverflow.com/questions/6230...s-in-views
I am trying to integrate react with Codeigniter 4. Its very easy to include js files by adding following line in my view file and keeping js files in public folder. Code: <script src="<?php echo base_url('react/react_file.js');?>"></script> We can also load .php files located within Views folder like following: Code: <?= view('include/any_php_file'); ?> But I want to keep js files in Views folder & want to load from there. How to include them from there in views? Any suggestions?
You can't. They need to be accessible from an url.
If you still want to store them there, you need to write a PHP-loader. That will try to find that file inside your views folder and include it. |
Welcome Guest, Not a member yet? Register Sign In |