Hi,
I whipped up this little php script, hopefully it helps.
PHP Code:
<?
// Define the Function
function print_link($string, $url){
$str = $string;
list($one,$two,$three) = explode(' ',$str);
print '<a href="'.$url.'">'.$one.' '.$two.' '.$three.'...';
}
// Print the Link
print_link('Dan likes to drool on dogs','http://www.dandrools.com');
?>
When called, this function will print out the first three words of what text you enter followed by "...". In this example, it will print "Dan likes to...".
I'm glad this helped. I must admit when I posted this, I was a bit sleep deprived and I missed a very important part: the "</a>" part. I appologize for that. Here's some non-sleepy code:
PHP Code:
<?
// Define the Function
function print_link($string, $url){
$str = $string;
list($one,$two,$three) = explode(' ',$str);
print '<a href="'.$url.'">'.$one.' '.$two.' '.$three.'...</a>';
}
// Print the Link
print_link('Dan likes to drool on dogs','http://www.dandrools.com');
?>
This will now render:
<a href="http://www.dandrools.com">Dan likes to...</a>
I would never expect anybody to do ALL the thinking for me! Thanks for the help!
BTW - in your example, my 80's brain keeps finishing the szentence as "Dan likes to..." - PARTY ALL THE TIME, PARTY ALL THE TIME, PARTY ALL THE TIIIIME. From Eddie Murphy's eighties music album, believe it or not! Anyway, ahem, back to work....
Bookmarks