homer.favenir Posted October 31, 2008 Share Posted October 31, 2008 hi, i have a javascript menu bar it has 1 folder (lib folder) and five files (menu.php - this is the index, demo.css, demo.js, mootools.js, .project). it is working on standalone. my question is how and where can i save this files in code igniter to work. i copy/paste it in the view and change the controller function index() to $this->load->view('menu',$data). but the effects didnt work, it should slide down, but what it did is just a link my menu.php script is <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html > <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" href="demo.css" type="text/css" /> [removed][removed] [removed][removed] <title>MouseEnter Demo</title> </head> <body> <div id="myElement"> </div> <div id="myOtherElement"> <span><strong>Menu</strong></span> <div> <a href="#">Client 1</a> <a href="#">Client 2</a> <a href="#">Client 3</a> </div> </div> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/130850-javascript-in-codeigniter-is-not-workign/ Share on other sites More sharing options...
wildteen88 Posted October 31, 2008 Share Posted October 31, 2008 You should place all your static files (css, js, images etc) where your index.php file is. Quote Link to comment https://forums.phpfreaks.com/topic/130850-javascript-in-codeigniter-is-not-workign/#findComment-679686 Share on other sites More sharing options...
Liquid Fire Posted November 1, 2008 Share Posted November 1, 2008 You should place all your static files (css, js, images etc) where your index.php file is. That is a pretty ugly structure to have your index.php, css, images, and js is the same folder without be able to break it up. Quote Link to comment https://forums.phpfreaks.com/topic/130850-javascript-in-codeigniter-is-not-workign/#findComment-679945 Share on other sites More sharing options...
wildteen88 Posted November 1, 2008 Share Posted November 1, 2008 You can place your images etc within separate folders too if you wish. The folders must be in the same directory as your index.php file though. You should not be putting any static content anywhere in your application folder. I tend to setup my CI directory structure like so My CodeIgnitor App | +-- System/ | +-- Application/ | +-- static/ | | | +-- images/ | | | +-- js/ | | | +- style.css +- index.php When loading say style.css within my views for example I'd use <link rel="stylesheet" type="text/css" href="<?php echo base_url().'static/style.css'; ?>" /> Quote Link to comment https://forums.phpfreaks.com/topic/130850-javascript-in-codeigniter-is-not-workign/#findComment-679969 Share on other sites More sharing options...
Liquid Fire Posted November 1, 2008 Share Posted November 1, 2008 You can place your images etc within separate folders too if you wish. The folders must be in the same directory as your index.php file though. You should not be putting any static content anywhere in your application folder. I tend to setup my CI directory structure like so My CodeIgnitor App | +-- System/ | +-- Application/ | +-- static/ | | | +-- images/ | | | +-- js/ | | | +- style.css +- index.php When loading say style.css within my views for example I'd use <link rel="stylesheet" type="text/css" href="<?php echo base_url().'static/style.css'; ?>" /> Ah... I thought tou mean something like My CodeIgnitor App | +-- System/ | +-- Application/ | +- jquery.js +- site.css +-etc... +- index.php Quote Link to comment https://forums.phpfreaks.com/topic/130850-javascript-in-codeigniter-is-not-workign/#findComment-680039 Share on other sites More sharing options...
wildteen88 Posted November 1, 2008 Share Posted November 1, 2008 Nope Quote Link to comment https://forums.phpfreaks.com/topic/130850-javascript-in-codeigniter-is-not-workign/#findComment-680042 Share on other sites More sharing options...
homer.favenir Posted November 4, 2008 Author Share Posted November 4, 2008 i got it! i copy/paste the javascript directory after the base url. C:\xampp\htdocs\DSValidator\javascript and change my script to <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html > <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" href="<?php echo base_url(); ?>javascript/demo.css" type="text/css" /> [removed][removed] [removed][removed] <title>MouseEnter Demo</title> </head> <body> <div id="myElement"> </div> <div id="myOtherElement"> <span><strong>Menu</strong></span> <div> <a href="#">Client 1</a> <a href="#">Client 2</a> <a href="#">Client 3</a> </div> </div> </body> </html> maybe this will help to anyone who have the same issue. im sorry but i didnt made the [remove][/remove] tag. its in the forum thanks for all the help guys. Quote Link to comment https://forums.phpfreaks.com/topic/130850-javascript-in-codeigniter-is-not-workign/#findComment-681758 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.