Jump to content

Recommended Posts

Posted

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?

Posted

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>";
}
Posted

Looks okay to me. You might want to account for other possibilities too, like https, etc.

$url = preg_replace('{^.+://}', '', $dealer-website); 
  • Like 1

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...