worldcomingtoanend Posted February 22, 2010 Share Posted February 22, 2010 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>"; Quote Link to comment https://forums.phpfreaks.com/topic/192906-how-can-i-echo-this-script-to-display-the-url-web-address/ Share on other sites More sharing options...
trq Posted February 22, 2010 Share Posted February 22, 2010 And where exactly do you expect http://www.company.com/ to come from? Quote Link to comment https://forums.phpfreaks.com/topic/192906-how-can-i-echo-this-script-to-display-the-url-web-address/#findComment-1015997 Share on other sites More sharing options...
worldcomingtoanend Posted February 22, 2010 Author Share Posted February 22, 2010 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 Quote Link to comment https://forums.phpfreaks.com/topic/192906-how-can-i-echo-this-script-to-display-the-url-web-address/#findComment-1015998 Share on other sites More sharing options...
eugene2009 Posted February 22, 2010 Share Posted February 22, 2010 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>"; ?> Quote Link to comment https://forums.phpfreaks.com/topic/192906-how-can-i-echo-this-script-to-display-the-url-web-address/#findComment-1016011 Share on other sites More sharing options...
worldcomingtoanend Posted February 22, 2010 Author Share Posted February 22, 2010 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; ?> Quote Link to comment https://forums.phpfreaks.com/topic/192906-how-can-i-echo-this-script-to-display-the-url-web-address/#findComment-1016050 Share on other sites More sharing options...
trq Posted February 22, 2010 Share Posted February 22, 2010 Cool, that makes so much more sense now. Quote Link to comment https://forums.phpfreaks.com/topic/192906-how-can-i-echo-this-script-to-display-the-url-web-address/#findComment-1016051 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.