Jump to content

problem with "require()" paths


flunn

Recommended Posts

I'm having a problem with  "php require()" paths.  This is what happens:

 

I have a php file ("FileA") in a directory  ("DirectoryA"). This file uses "require()" to access a header ("Header"), which itself is linked to a css style sheet and a graphic.  This works fine as long as everything is in the same directory, but when (after changing the "require()" call) I put FileA into a sub-directory of DirectoryA ("DirectoryA1"), there's a problem: the header is accessed, but the css file and the graphic are not. When FileA is in DirectoryA1, the "require()" call is written as follows

 

require('../Header.html')

 

I've experimented with other ways of describing the path and even tried to use an absolute path, but the results are always the same. I've also done some googling but could find nothing useful.

 

Any help with this will be much appreciated.

 

regards to all

Link to comment
Share on other sites

Thanks, Glyde, for your reply.

 

But: I'm not sure what you mean by 'modifying tags. Are there different sorts of "img" tags? (And, if so, how would I figure out which one I need here?) Also, I had no idea there was such a thing as a "css tag." I thought that ''css" was just used as an "extension" at the end of a file name.

 

Also, if this were a html problem, I don't see why everything would work fine when all the files were in the same directory, but not when they're in different directories.

Link to comment
Share on other sites

Thank you, premiso, for your reply. Basically your solution works fine. When I used absolute paths in the header the css style sheet and the graphic were accessed properly.

 

There's still a serious problem however: there's a "Flash" sound file linked to the page but now that I've moved that page into another directory, I can't access the Flash player. The Java code that sets this up is as follows:

 

<script type="text/javascript">

var s3 = new SWFObject("mp3player.swf", "line", "100", "20","7");

s3.addVariable("file","<?php print $listen; ?>");

s3.addVariable("repeat","false");

s3.addVariable("showdigits","true");

s3.write("flashbanner");

</script>

 

I tried replacing "mp3player.swf" with an absolute url but that didn't help. ("mp3player.swf" is in the same  directory as the file I'm working with was originally in.)

 

best regards and thanks again for your help.

 

 

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.