Welcome Guest, Not a member yet? Register   Sign In
How to atatch a JavaScript File? (
#1

[eluser]tzi0[/eluser]
my view header:
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
&lt;html&gt;
&lt;head&gt;
    &lt;title&gt;&lt;?php echo $page_title ?&gt;&lt;/title&gt;
    &lt;meta http-equiv="content-type content="text/html;charset=utf-8" /&gt;
    &lt;meta name="description" content="&lt;?php echo $page_description ?&gt;"&gt;
    &lt;meta name="keywords" content="&lt;?php echo $page_keywords ?&gt;"&gt;
    
    &lt;link rel="stylesheet" type="text/css" href="css/styles.css" /&gt;
    
    [removed][removed]
    
&lt;/head&gt;
i have js and css folders placed with my system and user_guide folders together. But none of my js functions doesnt work! firebug tells: <function> is not defined
styles doesnt works too
#2

[eluser]pickupman[/eluser]
You are using relative url's. This will work when there are no url segments. Use this for absolute url:
Code:
&lt;link rel="stylesheet" type="text/css" href="/css/styles.css" /&gt;

Adding the leading slash makes the link always relative to the domain/site root.
#3

[eluser]ELRafael[/eluser]
1. Use the search form.
2. Use base_url()
Code:
&lt;link rel="stylesheet" type="text/css" href="&lt;?php echo base_url(); ?&gt;css/styles.css" /&gt;
<write_here_script type="text/javascript" src="&lt;?php echo base_url();?&gt;js/jquery-1.4.2.min.js"></write_here_script>

Sometimes (or many times?) I have this kind of structure:
http://localhost/project_name
or
http://project_name.local/
or
http://production_env/~project_name/
and finally
http://www.project_name.tld/

So,base_url() is a good friend :lol:




Theme © iAndrew 2016 - Forum software by © MyBB