Solved

Include and Images(addressing)

Posted on 2003-11-22
2
200 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
ID: 9804747
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
ID: 9804756
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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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.
These days socially coordinated efforts have turned into a critical requirement for enterprises.
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

726 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