CodeIgniter Forums
Loading assets (js, css, ...) - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Loading assets (js, css, ...) (/showthread.php?tid=12077)

Pages: 1 2


Loading assets (js, css, ...) - El Forum - 10-05-2008

[eluser]Pascal Kriete[/eluser]
[quote author="Seppo" date="1223233554"]... if you have the relative path in the JS and you don't want to change it, you can use "base" tag[/quote]
When javascript sees this:
Code:
fileBottomNavCloseImage: 'images/closelabel.gif',
It tacks that to the end of the current url.


Loading assets (js, css, ...) - El Forum - 10-05-2008

[eluser]Dauntless[/eluser]
Owh, I must have read over that line; sorry.

I tried it, but no go:
Code:
<head>

<base href="<?=base_url();?>" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

It's still looking for /user/images/closelabel_gif


Loading assets (js, css, ...) - El Forum - 10-05-2008

[eluser]manilodisan[/eluser]
In your header:
Code:
<s\cript type="text/javascript">
        var base_url = '&lt;?= base_url () ?&gt;';
</\script>

Code:
In your javascript files where you need absolute url's:
fileBottomNavCloseImage: base_url + '/images/closelabel.gif',

Can you believe the XSS filtering here.....Tongue


Loading assets (js, css, ...) - El Forum - 10-05-2008

[eluser]Dauntless[/eluser]
But that would, once again, make me go through the entire lightbox script and look for paths ...

I'll try it (hoping it will only be the images), but hasn't anyone else tried implementing LightBox ?


Loading assets (js, css, ...) - El Forum - 10-05-2008

[eluser]manilodisan[/eluser]
[quote author="Dauntless" date="1223255150"]But that would, once again, make me go through the entire lightbox script and look for paths ...

I'll try it (hoping it will only be the images), but hasn't anyone else tried implementing LightBox ?[/quote]

Yes I did...it's only 1 path at the start of the file...


Loading assets (js, css, ...) - El Forum - 10-05-2008

[eluser]Dauntless[/eluser]
Alright, Thanks! I've adjusted the 2 paths at the beginning and it appears to be working.

Thank you, Manilodisan for giving the final answer, and to every body else who helped out Smile