Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2007-01-25 11:05:41

EVRAMP
New Member
Registered: 2006-09-30
Posts: 3

[textile] Links in comments

Hi, is it possible to make links starting with “http://” in comments automaticaly converting to hyperlinks? Thanx

Offline

#2 2007-02-19 15:04:00

softsea
New Member
Registered: 2007-02-19
Posts: 1
Website

Re: [textile] Links in comments

Here is a very short function used to parse URLs into links.

<?php
$text=“I like http://www.yahoo.com, http://www.google.com, and I connect through FTP to my site through ftp://www.mysite.com.”;

function url_links($string)
{
$string=preg_replace(“/(http:\/\/|ftp:\/\/)([^\s,]*)/i”,”<a href=’$1$2’>$1$2</a>”,$string);
return $string;
}

print url_links($text);
?>

Offline

#3 2009-02-15 20:13:05

nikolay
New Member
Registered: 2009-01-04
Posts: 6

Re: [textile] Links in comments

I need the same. However, can someone explain to me how to apply that php code for comments because I’m not familiar with php at all?

Offline

#4 2009-02-16 01:37:44

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: [textile] Links in comments

nikolay wrote:

I need the same. However, can someone explain to me how to apply that php code for comments because I’m not familiar with php at all?

By using wet_commentmagic or rah_urltolink plugins you can change URLs to valid links with out PHP skills.

For example, you could surround comment or comment message tag with:

<txp:rah_urltolink><txp:comments /></txp:rah_urltolink>

Or wet’s commentmagic could turn URLs into Textile syntax and thus into links.

Offline

#5 2009-02-16 19:19:16

nikolay
New Member
Registered: 2009-01-04
Posts: 6

Re: [textile] Links in comments

Thanks Gocom.

After your post I checked both plugins.

wet_commentmagic works fine but for the newly-posted comments only (but it is still ok).

rah_urltolink transforms even the already posted comments but there are issues with URLs like this: http://www.domain.com/?p=2257 . The result is <a href=“http://www.domain.com/”>www.domain.com/</a>?p=2257

I saw you are the guy behind ran_urltolink. Can you suggest solution of that issue?

I’m with txp 4.0.4.

Last edited by nikolay (2009-02-16 19:35:53)

Offline

#6 2009-04-23 00:34:20

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: [textile] Links in comments

nikolay wrote:

rah_urltolink transforms even the already posted comments but there are issues with URLs like this: http://www.domain.com/?p=2257 . The result is <a href=“http://www.domain.com/”>www.domain.com/</a>?p=2257

Sorry for the late response nikolay. It’s been fixed in the newer 0.3 version.

Offline

#7 2011-01-29 23:42:38

aramide
Member
Registered: 2011-01-24
Posts: 14

Re: [textile] Links in comments

I have just installed a wysiwyg editor hak tinyMCE. It is working well. Is there a way I can remove the textile help link on the comment area since it won’t be needed by those commenting

Offline

#8 2011-01-30 20:15:42

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: [textile] Links in comments

It’s in the form ‘comment_form’. Look for <txp:comments_help />.

Offline

Board footer

Powered by FluxBB