Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // if the $field_url is not present, proceed as normal
- if (empty($field_url)) {
- echo $content;
- // if the $field_url is present, format it as an actual url
- // the problem here is that $content may contain multiple urls, I want to do a regex
- // on only the $detected_url, even if the $detected_url is found multiple times in $content
- } else {
- $detected_field_url = $field_url;
- $formatted_url = "<a href=\"$detected_field_url\">$detected_field_url</a>";
- // this actually echoes nothing, i think because of unescaped characters?
- echo preg_replace("/$detected_field_url/", "/$formatted_url/", $content);
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement