Jump to content

javascript in codeigniter is not workign


homer.favenir

Recommended Posts

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>

Link to comment
Share on other sites

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'; ?>" />

 

 

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.