Solved

Include and Images(addressing)

Posted on 2003-11-22
2
202 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

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.
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
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:
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

705 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