Jump to content

How can I echo this script to display the URL web address?


worldcomingtoanend

Recommended Posts

After running this script I get a display of " /cars/bmw/305.html "  but what I actually need is to display http://www.company.com/cars/bmw/305.html. 

Thank you for your help.

 

    print "<div><a href="\""." $linkPrefix="" .="" $hit["VISIBLEPATH"]="" .="" "\"="" target="\"blank\"">" . $hit["VISIBLEPATH"] . "</a></div>";

And where exactly do you expect http://www.company.com/ to come from?

 

Ok Thorpe....my website is http://www.company.com (example of course) and I am programming a search engine and I have two scripts in my server...the first script sends the search information to the other script which then displays the searched results where a user can then click to go to their search page. Now the bad thing is the displayed results are showing a path like this /***/***/***.html which is ok for an unpublished website and only useful on my test machine here but not a useful link to users out there.  All I need is a way of appending http://www.company.com at the beginning so that the search result links will work online.  to rephrase it again..../***/***/***.html is quiet okay in my local machine running wamp server but  http://www.company.com/***/***/***.html  is okay if its now a published website.

 

Thank you

hmm if its the same url over and over just do this

 

<?

echo "<a href=\"http://www.company.com".$whatever_the_link_is."\">http://www.company.com".$whatever_the_link_is."</a>";

?>

 

Thank you for your help all of you.  I finally managed to find a solution by using the code below:

 

<?php
$destinationUrl = "www.cars.com/www/buses/coachescontent/index.html";
$destinationUrl = str_replace("/www/", "/", $destinationUrl);
echo $destinationUrl;
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.