Welcome Guest, Not a member yet? Register   Sign In
include javascript in CI4 view
#1

(This post was last modified: 11-11-2024, 09:50 AM by jcarvalho. Edit Reason: added some code sample to improve problem )

Hi guys, I am struggling with add a javascript file into my view in CI4
in CI3 I just did $this->load->view('js/dtArtigos.js'); to load a datatable definition with some php in the mix like <?php
$settings = new \Config\Conffile();

?> .
I have tried inside script tag
<? = $this->include('js/dtArtigos.js');?> with no luck
<?=file_get_contents( __DIR__ . '/js/dtArtigos.js'); ?> with no luck

for organization purposes I like the javascript files inside views, folder view controller like for example products and a a folder js to hold my js
for example
--/app/Views/products/js

What is the correct way to have this working? I prefer nor ro do <script src="xxxxxx"></script> but echoing the file contect in view file inside script tag
Many thanks!
Reply


Messages In This Thread
include javascript in CI4 view - by jcarvalho - 11-11-2024, 09:15 AM
RE: include javascript in CI4 view - by warcooft - 11-11-2024, 10:46 AM
RE: include javascript in CI4 view - by jcarvalho - 11-11-2024, 11:06 AM
RE: include javascript in CI4 view - by InsiteFX - 11-11-2024, 11:33 PM
RE: include javascript in CI4 view - by jcarvalho - 11-12-2024, 03:42 AM
RE: include javascript in CI4 view - by InsiteFX - 11-12-2024, 04:02 AM
RE: include javascript in CI4 view - by jcarvalho - 11-12-2024, 07:31 AM
RE: include javascript in CI4 view - by InsiteFX - 11-12-2024, 11:00 PM



Theme © iAndrew 2016 - Forum software by © MyBB