Solved

Include and Images(addressing)

Posted on 2003-11-22
2
197 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

This article discusses how to create an extensible mechanism for linked drop downs.
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

912 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

20 Experts available now in Live!

Get 1:1 Help Now