View Full Version : Grabbing remote page, links/imgs don't work..
04-02-2003, 03:56 PM
04-02-2003, 05:41 PM
When files are included the source targets are originating from the folder that the script that includes the file is in. Example, say you have the main script in /fun and the include in /fun/includes.
In the included script you have to set all of the non-absolute links to show as if the script was in the /fun folder. so if your images folder is /images the image links in the main script as well as the unclude have to be images/file.ext.
You're probably setting the images like ../images/file.ext in the include file. Or so thats what it seems.
Let me know if that helped.
if you had to add "http://domain.whatever/folder/folder before each image that didn't have that, you'd need some form of clever regex.
a sneaky (and also untested) workaround it to sling a <base href=" at the top of their included output - that should ignore hrefs and srcs that start http and just effect the rest.
echo '<base href="' .substr($file,0,strrpos('/',$file)). '">';
couldn't remember which way the strrpos accepts its parameters either.
Powered by vBulletin® Version 4.2.2 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.