aznjay Posted September 16, 2008 Share Posted September 16, 2008 Let's say i have a content like this: BLAH BLAH BLAHBLAH BLAH BLAHBLAH BLAH BLAHBLAH BLAH BLAHBLAH BLAH BLAHBLAH BLAH BLAHBLAH BLAH BLAHBLAH BLAH BLAHBLAH BLAH BLAHBLAH BLAH BLAHBLAH BLAH BLAHBLAH BLAH BLAHBLAH BLAH BLAHBLAH BLAH BLAHBLAH BLAH BLAHBLAH BLAH BLAHBLAH BLAH BLAHBLAH BLAH BLAHBLAH BLAH BLAHBLAH BLAH BLAHBLAH BLAH BLAHBLAH BLAH BLAHBLAH BLAH BLAHBLAH BLAH BLAHBLAH BLAH BLAHBLAH BLAH BLAHBLAH BLAH BLAHBLAH BLAH BLAHBLAH BLAH BLAHBLAH BLAH BLAHBLAH BLAH BLAHBLAH BLAH BLAHBLAH BLAH BLAHBLAH BLAH BLAHBLAH BLAH BLAHBLAH BLAH BLAHBLAH BLAH BLAHBLAH BLAH BLAHBLAH BLAH BLAHBLAH BLAH BLAHBLAH BLAH BLAHBLAH BLAH BLAHBLAH BLAH BLAHBLAH BLAH BLAHBLAH BLAH BLAHBLAH BLAH BLAHBLAH BLAH BLAHBLAH BLAH BLAHBLAH BLAH BLAHBLAH BLAH BLAHBLAH BLAH BLAHBLAH BLAH BLAHBLAH BLAH BLAHBLAH BLAH BLAHBLAH BLAH BLAHBLAH BLAH BLAHBLAH BLAH BLAHBLAH BLAH BLAHBLAH BLAH BLAHBLAH BLAH BLAHBLAH BLAH BLAHBLAH BLAH BLAHBLAH BLAH BLAHBLAH BLAH BLAHBLAH BLAH BLAHBLAH BLAH BLAHBLAH BLAH BLAHBLAH BLAH BLAHBLAH BLAH BLAH How can I make the content shorter in this format: BLAH BLAH BLAHBLAH BLAH BLAHBLAH BLAH BLAHBLAH BLAH BLAHBLAH BLAH BLAHBLAH BLAH BLAHBLAH BLAH BLAHBLAH BLAH BLAHBLAH BLAH BLAHBLAH BLAH BLAHBLAH BLAH BLAHBLAH BLAH BLAHBLAH BLAH BLAHBLAH BLAH BLAHBLAH BLAH BLAHBLAH BLAH BLAHBLAH BLAH BLAHBLAH BLAH BLAH...Read More <---this will be a link to the full content I appreciate anyone that could help me... Link to comment https://forums.phpfreaks.com/topic/124547-read-morehelp/ Share on other sites More sharing options...
The Little Guy Posted September 16, 2008 Share Posted September 16, 2008 Try this: http://phpsnips.com/snippet.php?id=15 Link to comment https://forums.phpfreaks.com/topic/124547-read-morehelp/#findComment-643227 Share on other sites More sharing options...
aznjay Posted September 16, 2008 Author Share Posted September 16, 2008 Try this: http://phpsnips.com/snippet.php?id=15 The snippet is confusing I don't know where to put it... Link to comment https://forums.phpfreaks.com/topic/124547-read-morehelp/#findComment-643231 Share on other sites More sharing options...
The Little Guy Posted September 16, 2008 Share Posted September 16, 2008 do you have a page that hold functions? Link to comment https://forums.phpfreaks.com/topic/124547-read-morehelp/#findComment-643233 Share on other sites More sharing options...
cooldude832 Posted September 16, 2008 Share Posted September 16, 2008 if it seems reasonable you can use JS to toggle the display properties of the content. i.e <div id="content_1"> BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH <div id="content_1_hide"> BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH </div> And a link will run a js function to toggle the dive content_1_hide from display to none If it seems unreasonable use a link (possibly a new window (transitional doc type target="_blank") that just shows the whole single portion via a GET parameter Link to comment https://forums.phpfreaks.com/topic/124547-read-morehelp/#findComment-643239 Share on other sites More sharing options...
unkwntech Posted September 16, 2008 Share Posted September 16, 2008 //$str the string to be shortened //$n the desired length function shot_desc($str, $n, $delim='…') { $len = strlen($str); if ($len > $n) { preg_match('/(.{' . $n . '}.*?)\b/', $str, $matches); return rtrim($matches[1]) . $delim; } else { return $str; } } Link to comment https://forums.phpfreaks.com/topic/124547-read-morehelp/#findComment-643243 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.