2010-06-05 3 views
0

내 의견 상자에 php wordwrap을 사용하고 있습니다.링크 클릭 가능 및 단어 랩

이 내 클릭 기능,

function clickable_link($text) 
{ 
$ret = ' ' . $text; 
$ret = preg_replace("#(^|[\n ])([\w]+?://[\w\#$%&~/.\-;:=,[email protected]\[\]+]*)#is", "\\1<a class=\"hrefLink\" href=\"\\2\" target=\"_blank\">\\2</a>", $ret); 
$ret = preg_replace("#(^|[\n ])((www|ftp)\.[\w\#$%&~/.\-;:=,[email protected]\[\]+]*)#is", "\\1<a class=\"hrefLink\" href=\"http://\\2\" target=\"_blank\">\\2</a>", $ret); 
$ret = preg_replace("#(^|[\n ])([a-z0-9&\-_.]+?)@([\w\-]+\.([\w\-\.]+\.)*[\w]+)#i", "\\1<a href=\"mailto:\\[email protected]\\3\">\\[email protected]\\3</a>", $ret); 
$ret = substr($ret, 1); 
return $ret; 
} 

이며,이 25의 단어 한계에 도달하면, 내 댓글 상자 내 링크 휴식,

$comment = clickable_link($comment); 
$comment = wordwrap($comment, 25, "\n", false); 

그래서 의견에 대한 내 단어 잘림입니다

http://www.websitetitle.com/showthread.php?t=2000 

링크가 이렇게됩니다

http://www.websitetitle.com/showthread.php? 
<br> 
t=2000 

링크가 끊어졌습니다. 그래서 링크 또는 다른 해결 방법을 고칠 수 있습니까?

답변

0

잘림 방지 기능은 링크를 깨는 감사합니다.

댓글 상자의 너비를 제한하려는 경우 wordwrap 기능에 의존하지 말고 CSS 내에서해볼 것을 제안합니다.