Forum Moderators: coopster

Message Too Old, No Replies

include file path error

         

ploppy

1:12 pm on Aug 5, 2010 (gmt 0)

10+ Year Member



hello
i am having trouble getting an include file to work. it displays the basic page but is not picking up the css or js that is in the header.php file. directory structure is like this:

admin/header.php
admin/js/jsfiles etc
admin/files/index.php

in files/index.php i have included the line <?php include("../header.php"); ?> which displays the header.php page but none of the js or css files. firebug is reporting them as 'not found.. what is the correct way to do this? many thanks

sample header.php with js and css etc

<script src="js/jquery-1.3.2.min.js"></script>
<link href="jmenu/css/jmenu.css" rel="stylesheet" type="text/css" />
these are just snippets of code in there.

morehawes

2:04 pm on Aug 5, 2010 (gmt 0)

10+ Year Member



Hi,

<script src="js/jquery-1.3.2.min.js"></script>


Looks like the problem might be the HTML does not contain the correct relative URL. Try using absolute URLs to see if that helps : [webdevelopersnotes.com ]

Or inspect the URL displayed in Firebug that is causing the problem and see where is has gone wrong.

morehawes

2:04 pm on Aug 5, 2010 (gmt 0)

10+ Year Member



Hi,

<script src="js/jquery-1.3.2.min.js"></script>


Looks like the problem might be the HTML does not contain the correct relative URL. Try using absolute URLs to see if that helps : [webdevelopersnotes.com ]

Or inspect the URL displayed in Firebug that is causing the problem and see where is has gone wrong.

ploppy

2:23 pm on Aug 5, 2010 (gmt 0)

10+ Year Member



firebug is saying:

The requested URL /sample/admin/files/js/jquery-1.3.2.min.js was not found on this server.

the address it should be looking at is:

The requested URL /sample/admin/js/jquery-1.3.2.min.js

thanks

morehawes

2:27 pm on Aug 5, 2010 (gmt 0)

10+ Year Member



In that case update index.php to :

<script src="../js/jquery-1.3.2.min.js"></script>

etc

ploppy

3:47 pm on Aug 5, 2010 (gmt 0)

10+ Year Member



[RESOLVED] many thanks for your help. this is resolved. i couldn't find a resolved option anywhere.

morehawes

3:53 pm on Aug 5, 2010 (gmt 0)

10+ Year Member



You're welcome, glad I could help out :)