<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>NewSourceMedia Blog &#187; short</title>
	<atom:link href="http://newsourcemedia.com/blog/tag/short/feed/" rel="self" type="application/rss+xml" />
	<link>http://newsourcemedia.com/blog</link>
	<description>Focused on Interactive Design, Development and Marketing</description>
	<lastBuildDate>Fri, 30 Dec 2011 04:30:03 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>Portion() function for trimming text</title>
		<link>http://newsourcemedia.com/blog/portion-function-for-trimming-text/</link>
		<comments>http://newsourcemedia.com/blog/portion-function-for-trimming-text/#comments</comments>
		<pubDate>Wed, 23 Feb 2005 00:22:11 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[String Manipulation]]></category>
		<category><![CDATA[length]]></category>
		<category><![CDATA[lenth.]]></category>
		<category><![CDATA[short]]></category>
		<category><![CDATA[shorten]]></category>
		<category><![CDATA[shorter]]></category>
		<category><![CDATA[start]]></category>
		<category><![CDATA[text]]></category>
		<category><![CDATA[trim]]></category>
		<category><![CDATA[values]]></category>

		<guid isPermaLink="false">http://newsourcemedia.com/blog/2005/02/22/portion-function-for-trimming-text/</guid>
		<description><![CDATA[Returns the portion of text specified by the start and length parameters. This help to trim text down for display in a small area or to give a sample of a larger body of text. I created this function to &#8230; <a href="http://newsourcemedia.com/blog/portion-function-for-trimming-text/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[Returns the portion of text specified by the start and length parameters. This help to trim text down for display in a small area or to give a sample of a larger body of text.
<span id="more-184"></span>

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:
<pre lang="php"> <?
// function starts here
function portion($max_len,$str){
if(!$max_len)
$max_len = 12; // default max length of characters including blank spaces
if (strlen($str) > $max_len){
echo substr("$str", 0, $max_len)."..."; // your portion of text with trailing 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..." )

?></pre>]]></content:encoded>
			<wfw:commentRss>http://newsourcemedia.com/blog/portion-function-for-trimming-text/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
<!-- WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! -->
