antknight Posted November 30, 2012 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?
Martijn Geerts Posted December 1, 2012 Posted December 1, 2012 maybe something like this: $yourUrlField = str_replace('http://', '', $page->yourUrlField); echo $yourUrlField; 1
antknight Posted December 2, 2012 Author 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>"; }
ryan Posted December 2, 2012 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
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