CodeIgniter Forums
auto_link with <p> tags - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: auto_link with <p> tags (/showthread.php?tid=32509)



auto_link with <p> tags - El Forum - 07-26-2010

[eluser]Konfine[/eluser]
Hi All,

I've come across with a problem using the URL Helper -> auto_link function.

I'm currently creating a forum in which I use the TinyMCE JS editor for the posts, when I return back the main post the JS automatically enters the <p> tags for each new line in the database, this isn't a problem but even when passing the function around the description it's not correctly returning a linked URL.

example:

Code:
auto_link("<p>www.shopto.net</p>")

Can anyone tell me how to fix this?

Thanks in advance!


auto_link with <p> tags - El Forum - 07-27-2010

[eluser]Konfine[/eluser]
Bump?


auto_link with <p> tags - El Forum - 07-27-2010

[eluser]Derek Allard[/eluser]
Yup, looks like a bug. Feel free to file a bug report Konfine. you can get around it by adding spaces before your url.


auto_link with <p> tags - El Forum - 03-15-2011

[eluser]infinivert[/eluser]
I'm running into this same bug. Wouldn't this just be a quick adjustment to the RegEx here?

Code:
if ($type != 'email')
        {
            if (preg_match_all("#(^|\s|\()((http(s?)://)|(www\.))(\w+[^\s\)\<]+)#i", $str, $matches))
            {

I'm not very good with RegEx. Anybody know how to fix this so links within paragraph (or other) tags will be auto-linked?

Thanks!