antknight Posted November 30, 2012 Share Posted November 30, 2012 Is there a way to stop the URL field adding http:// upon save? Or perhaps there is just a way to strip the http:// for display on the front end? Link to comment Share on other sites More sharing options...
Martijn Geerts Posted December 1, 2012 Share Posted December 1, 2012 maybe something like this: $yourUrlField = str_replace('http://', '', $page->yourUrlField); echo $yourUrlField; 1 Link to comment Share on other sites More sharing options...
antknight Posted December 2, 2012 Author Share Posted December 2, 2012 This is what I came up with, it works, does it look ok? foreach($country->children() as $dealer) { $url = str_replace('http://', '', $dealer->website); echo "<tr class='reviews-row1'><td><strong>{$dealer->title}</strong><br>{$dealer->map_marker->address}</td>"; echo "<td>{$dealer->telephone}</td>"; echo "<td><a href='{$dealer->website}' target='_blank'>{$url}</a></td>"; echo "<td><a href='mailto:{$dealer->email}'</a>{$dealer->email}</td>"; echo "</tr>"; } Link to comment Share on other sites More sharing options...
ryan Posted December 2, 2012 Share Posted December 2, 2012 Looks okay to me. You might want to account for other possibilities too, like https, etc. $url = preg_replace('{^.+://}', '', $dealer-website); 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now