Jump to content

Not picking up associated files with include (url)


dtc

Recommended Posts

I run a site for a village (cornworthy_dot_com) that includes groups with their own pages on different servers. Currently I display their sites using frames so that we can include a home button. However, this is not entirely satisfactory and the ideal solution would be to display our fixed CSS menu at the top of the page. I have tried all sorts of way to do this using varieties of includes but all end up with the same result:-
The page is included sucessfully, but associated files (e.g. CSS and backgrounds are not).
I have searched the various FAQ's, groups etc for an answer to this (or a comment such as "dumbo it can't be done") but have not found a solution to what I thought would be a common problem - it is possible that being a newbie I didn't undersatnd the answers of couse.
Thanks
Lofty
Link to comment
Share on other sites

Can you post some code?
I think you are having a problem because you use the <html>, <head> and <body> tags in your body tag.
Like this:
[code]
<html>
<head>
<link rel="stylesheet" type="text/css" ...>
</head>
<body>
<!-- include the remote file -->
<?php
include("file.htm");
?>
</body>
</html>[/code]

The problem is that "file.htm" has it's own <html>, <head> and whatever tags, so you make something with no sense...

But I cant be sure thats what happened, since you havent posted any code...

Orio.
Link to comment
Share on other sites

Hi Orio - thanks for responding.
Currently there are two html files plus the one that does the calling. I will remove two and retest - I have knocked up some code that represents th problem I have - cornworthy.com/pages/test1.php?http://www.hunterslodgeinn.co.uk
calls test2html which contains body and head tags
code is here
[code]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>

<?PHP
$mypath = "http://cornworthy.com/pages/test2.html";
include $mypath;
?>

<?PHP
$mypath = $_SERVER['argv'][0];
echo "Cornworthy Village, Devon, England";
include $mypath;
?>

</body>
</html>
[/code]
I will let you know the result.
Link to comment
Share on other sites

Done that - removed header and body tags from both (saved as test3.php calling test4.html (with no head/body tags)).
They are at the same url.
Got the same result
Lofty
Link to comment
Share on other sites

Done it - well almost, but it's a bit of a bodge to say the least.
PHP calls Perl, which on our Apache is resident anyway.
Perl mirrors the page - parses it as prints it and adds the target url before such things as CSS and images.
If the browser clicks on a page in another directory it manages to add that to the url (we always start at the index page in the html_public root).
The perl file is called with
[code]
<?php echo @stripslashes ( @join( @file( "http://cornworthy.com/cgi-bin/showurl" ),"\?http://cornworthy.com/imagelibrary/index.htm" ) ) ?>
[/code]
However you may noticed a problem here that I haven't got around yet. This is where I now need PHP help.
The URL in the test was hard coded and I need to pass an argument (the target url) to perl as above. The '?' even when escaped is read by PHP and we get nothing.
If I can get around that I have achieved what I need and only used HTML, PHP and Perl - completely and sucessfully avoiding C, C++, Forth, VB, Pascal, Cobol, Assembler, MASM, TASB, C#, .net, Fortran ........
Help would be much appreciated - I'm pulling my hair out and I don't have much left as it is!

Link to comment
Share on other sites

OK done it - bearing in mind that this could be abused, I won't publish it here. If anyone is interested, please pm me stating your required use.
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.