views:

156

answers:

2

am having a hard time trying to make jquery lightbox in codeigniter work, what I want to happen is,pop a youtube thumbnail and play the video on the lightbox.I stored it outside my application directory,I included it in my config file like this $config['jquery'] = "js/jquery1.4.2.js";
then I include on the view file like this

<script type="text/javascript" src="<?php echo "$base"."js/jquery1.4.2.js"; ?>"></script> 
<script type="text/javascript" src="<?php echo "$base"."js/js/jquery.lightbox-0.5.js"; ?>"></script>  
<link rel="stylesheet" type="text/css" href="<?php echo "$base"."js/css/jquery-lightbox-0.5.css"; ?>" media="screen" />

the controller function is like this

$data['css'] = $this->config->item('css');
$data['jquery'] = $this->config->item('jquery');
$this->load->view('aboutus',$data);

and it doesn't work ..I tried the plugin on a static test html page, it works fine :(

A: 

I had a similar question some time ago...paths in codeigniter don't work as expected...

http://stackoverflow.com/questions/3022796/jquery-and-codeigniter

rabidmachine9
A: 

This is how i would include the files:

<script type="text/javascript" src="<?php echo base_url() ?>js/jquery1.4.2.js"></script> 
<script type="text/javascript" src="<?php echo base_url() ?>js/js/jquery.lightbox-0.5.js"></script>  
<link rel="stylesheet" type="text/css" href="<?php echo base_url() ?>js/css/jquery-lightbox-0.5.css" media="screen" />

Assuming js/ is in the root of your public_html. If its not you will need the full relative path like so:

<script type="text/javascript" src="<?php echo base_url() ?>assets/js/file.js"></script>

I hope this helps

DRL
here's the url of test site http://digitustest.zzl.org/home/aboutus please advise me what to do..when i click the youtube thumbnail..it goes to youtube website and not in a lightbox :(
sasori
Hi sasori, your base_url appears to be wrong; in application/config/config.php you need to put $config['base_url'] = "http://digitustest.zzl.org/home/"; And then include the files as per my answer above.
DRL
thanks for the comment..but if I'll add /home/ to the base_url, it'll remove the main css filethe current config file of that live test site is this $config['base_url'] = "http://digitustest.zzl.org/"; $config['css'] = "css/styles.css";
sasori
Your lightbox files are showing up as not found so there is something wrong with the path; is the js/ folder in the same directory as the css/ folder? If not, put it there.
DRL
outside the application directory , I have css, js, images directories,,I extracted the lightbox package inside that js directory..thats why I have a js/js/jquery , and js/css/jquery-lightbox css sort of stuff ....and it didn't help even if I moved all the lightbox stuff from the main js directory to the main css directory including the lightbox js stuff
sasori