Hard code to remove http://www.
gausarts - September 20, 2008 - 09:42
| Project: | Link |
| Version: | 6.x-2.3.1 |
| Component: | Miscellaneous |
| Category: | support request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Jump to:
Description
I have a link with print $node->field_link[0]['url'], like this:
http://www.yoursite.com/bla/bla/bla
How to remove http://www. and /bla/bla/bla, so that I can grab only:
yoursite.com
It doesn't need to be linkable/ clickable at any rate. Any hint? Thanks

#1
i'm sure you can do it with regular expressions but using str_replace is all you need
<?php$link = $node->field_link[0]['url'];
$link = str_replace('http://www.', '', $link);
?>
This will be all
#2
I knew I could miss it:) Thanks for the hint
#3
Automatically closed -- issue fixed for two weeks with no activity.