Solved

Include and Images(addressing)

Posted on 2003-11-22
2
196 Views
Last Modified: 2013-11-18
Im having trouble with the include method and images (their addressing)

i.e If I include ("http://www.google.com"); at abc.com I'll get everything ok except for the logo, because the logo address goes from: http://www.google.com.au/intl/en_au/images/logo.gif to: http://www.abc.com/images/logo.gif

I need it so when I include a file it includes the correct addresses, not the addressing in the html...

Is there a way to do this?
0
Comment
Question by:fairon
  • 2
2 Comments
 
LVL 6

Expert Comment

by:mattjp88
Comment Utility
well here is a way to include the googe homepage and have the logo show up:

<?php
function callback($buffer) {

// replace all the apples with oranges
  return (ereg_replace("<img src=\"/images/logo.gif\" width=276 height=110 alt=\"Google\">", "<img src=\"http://www.google.com/images/logo.gif\" width=276 height=110 alt=\"Google\">", $buffer));

}

ob_start("callback");

include "http://www.google.com/webhp?tab=iw&q=&ie=UTF-8&oe=UTF-8&hl=en";

ob_end_flush();
?>

You basicly have to go through every link and do the replace function.

-Matt
0
 
LVL 6

Accepted Solution

by:
mattjp88 earned 500 total points
Comment Utility
Wait, I found and easier way, here is an example:

echo "<base href=\"http://www.google.com/\">";

include "http://www.google.com/webhp?tab=iw&q=&ie=UTF-8&oe=UTF-8&hl=en";

just echo <base href=\"http://www.google.com/\"> before you include to tell the file where the links and images should point to.  

-Matt
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Trouble parsing soap xml result 3 26
MYSQL simple update statement 3 32
php documentation 4 19
Setting Up Local Lan Web Server 1 12
Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now