0

How i can remove http:// in html page output is http://example.org

I just want to see it without http:// and www if possible, i just need to see it. in output html page example.org I got this code from .tpl file

<a href="{$listing.view_list_url}" >{$listing.record.url}</a>

Help me

kenorb
  • 155,785
  • 88
  • 678
  • 743
MyBox
  • 19
  • 1
  • Which CMS/framework do you use? – kenorb May 27 '15 at 15:34
  • This file is using PHP – MyBox May 27 '15 at 15:35
  • And TPL file is handled by which CMS/framework? Drupal, Wordpress, Joompla? Can you share code which generates those `$listing` variables? If you asking in plain PHP, the easiest way is to use [str_replace()](http://php.net/str_replace), e.g. `$listing.record.url = str_replace("http://", "", $listing.record.url);`, but you've to find the backend code responsible for this first. – kenorb May 27 '15 at 15:41
  • 1st one its not working for me, the method is right but no, idea how do i apply, if i apply same, thats not working in this file....yes its php...i got a code "" – MyBox May 27 '15 at 16:05
  • Your code is not complete, `$listing.record.url` is PHP variable within HTML code which is defined somewhere else in your code. Usually you don't add any parsers into your TPL file, you've to check where these variables are coming from. – kenorb May 27 '15 at 16:10
  • Yes mate, i got your point, thank you.....now i trying to search back-end code....sorry i'm a PHP beginner – MyBox May 27 '15 at 16:35
  • If it's Linux, try: `grep -Rn listing .` or `grep -Rn view_list_url .` within the directory where is the code. – kenorb May 27 '15 at 16:40
  • 1
    Thank you str_replace code is working... – MyBox May 30 '15 at 15:10
  • possible duplicate of [How to remove part of a string?](http://stackoverflow.com/questions/2192170/how-to-remove-part-of-a-string) – kenorb May 30 '15 at 15:15

0 Answers0