gabrielserban Posted June 19, 2006 Share Posted June 19, 2006 helloi have a problem with some long links that i'm writting on my forum.i tried to use$message = wordwrap($message, 80, "\n", 1);on the post body, but the second row of the link is no longer part of itdoes anyone know what can i do??thxi'm adding a test link here to see if it's like my forum[a href=\"http://testing.testing.com/Testing_testing_testing_testing/test_test_test_test/testing_testing_testing\" target=\"_blank\"]http://testing.testing.com/Testing_testing...testing_testing[/a]hmmmthe name is shortedhow is this done?in the database post.post_text doesn't have tags, only url Link to comment https://forums.phpfreaks.com/topic/12372-wrap-long-links/ Share on other sites More sharing options...
kanikilu Posted June 19, 2006 Share Posted June 19, 2006 Very basic example:[code]<?php$message = 'http://testing.testing.com/Testing_testing_testing_testing/test_test_test_test/testing_testing_testing';$max_length = 50;if (strlen($message) > $max_length) { $part1 = substr($message, 0, (($max_length / 2) - 1)); $part2 = substr($message, -10); $url = $part1 . '...' . $part2;} else { $url = $message;} echo "<a href='$message'>$url</a>";?>[/code] Link to comment https://forums.phpfreaks.com/topic/12372-wrap-long-links/#findComment-47318 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.