I created this function to display a portion of listings on my home page under
their related links to the full body of content.
This can helps your visitor to
find the content faster as well as helps search engine better index your web
site.
Portion() Code:
<?
// function starts here
function portion($max_len,$str){
if(!$max_len)
$max_len = 12; // defult max length of characters including blank spaces
if (strlen($str) > $max_len){
echo substr("$str", 0, $max_len)."..."; // your portion of
text with traling dots "..."
}
else
echo $str;
}
// function code end here
$str = "Hello World"; // edit or delete this line for your use
portion(7,"$str"); // call the function ( this will return "Hello
W..." )
?>
NewSourceMedia is providing links to these listings as
a courtesy, and makes no representations regarding the content or
any information related thereto. Any questions, complaints or claims
regarding the downloaded content or details must be directed to the appropriate
publisher. We do not encourage or condone the use of any
software in violation of applicable laws.