<?xml version="1.0" encoding="UTF-8"?>    <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
      <channel>
        <title>Limit amount of text shown</title>
        <link>https://interactivetools.com/forum/forum-posts.php?Limit-amount-of-text-shown-69351</link>
        <description></description>
        <pubDate>Mon, 20 Apr 2026 12:23:18 -0700</pubDate>
        <language>en-us</language>
        <atom:link href="https://interactivetools.com/forum/forum-posts.php?rss=1&amp;Limit-amount-of-text-shown-69351" rel="self" type="application/rss+xml" />

                <item>
          <title>Re: [chris] Limit amount of text shown</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2208116#post2208116</link>
          <description><![CDATA[Works great Chris!!! Thanks for the help!<br />Zick<br />]]></description>
          <pubDate>Wed, 17 Nov 2010 20:06:38 -0800</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2208116#post2208116</guid>
        </item>
                <item>
          <title>Re: [zick] Limit amount of text shown</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2208115#post2208115</link>
          <description><![CDATA[Hi zick,<br /><br />How about converting your &lt;li&gt;&lt;/li&gt; to &lt;p&gt;&lt;/p&gt; and making sure there's a space inserted in place of your &lt;br/&gt;?<br /><br /><code>function maxWords($html, $maxWords) {<br />  $html = str_replace(&quot;&lt;li&gt;&quot;,&quot;&lt;p&gt;&quot;,$html);<br />  $html = str_replace(&quot;&lt;/li&gt;&quot;,&quot;&lt;/p&gt;&quot;,$html);<br />  $html = str_replace(&quot;&lt;p&gt;&quot;,&quot;*P*&quot;,$html);<br />  $html = str_replace(&quot;&lt;/p&gt;&quot;,&quot;*/P*&quot;,$html);<br />  $html = str_replace(&quot;&lt;&quot;,&quot; &lt;&quot;,$html);<br />  $text = strip_tags($html);<br />  $words = preg_split(&quot;/\s+/&quot;, $text, $maxWords+1);<br />  if (count($words) &gt; $maxWords) { unset($words[$maxWords]); }<br />  $output = join(' ', $words);<br />  $output=str_replace(&quot;*P*&quot;,&quot;&lt;p&gt;&quot;,$output);<br />  $output=str_replace(&quot;*/P*&quot;,&quot;&lt;/p&gt;&quot;,$output);<br />  $output.=&quot;&lt;/p&gt;&quot;;<br /><br />  return $output;<br />}</code><br /><br />Does that help?<br />]]></description>
          <pubDate>Wed, 17 Nov 2010 18:08:05 -0800</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2208115#post2208115</guid>
        </item>
                <item>
          <title>Re: [Dave] Limit amount of text shown</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2208090#post2208090</link>
          <description><![CDATA[Dave,<br />I've marked the problem areas red. You'll see when a break &lt;br/&gt; is used to start a new sentence and maxWords is used, there's no space between the last sentence's period and where the new sentence starts. You'll also see the &lt;li&gt; bullet list items are not wrapped in &lt;ul&gt;&lt;li&gt;, nor wrapped in &lt;p&gt; as a result of the maxWords code, so the bullet list is loosing all &lt;p&gt; formatting and thereby the font's style does not match the rest of the article.<br /><br /><b>Here's a sample of the page code:</b><br /><code>&lt;?php header('Content-type: text/html; charset=utf-8'); ?&gt;<br />&lt;?php<br /><br />  // load viewer library<br />  $libraryPath = 'abc/lib/viewer_functions.php';<br />  $dirsToCheck = array('/home/content/a/b/c/economics/html/','','../','../../','../../../');<br />  foreach ($dirsToCheck as $dir) { if (@include_once(&quot;$dir$libraryPath&quot;)) { break; }}<br />  if (!function_exists('getRecords')) { die(&quot;Couldn't load viewer library, check filepath in sourcecode.&quot;); }<br />  <br />    // load records - core page content<br />  list($economicsRecords, $economicsMetaData) = getRecords(array(<br />    'tableName'   =&gt; 'economics',<br />    'where'       =&gt; whereRecordNumberInUrl(1),<br />    'limit'       =&gt; '1',<br />  ));<br />  $economicsRecord = @$economicsRecords[0]; // get first record<br /><br />   // load a single featured news record used with maxWords<br />  list($economic_newsFeaturedRecords, $economic_newsFeaturedMetaData) = getRecords(array(<br />    'tableName'   =&gt; 'economic_news',<br />	'where'         =&gt;  &quot;economics_categories&quot;,<br />    'limit'       =&gt; '1',<br />  ));<br />  <br />  // load 4 news records displaying only their titles and date<br />  list($economic_newsRecords, $economic_newsMetaData) = getRecords(array(<br />    'tableName'   =&gt; 'economic_news',<br />	//'allowSearch'   =&gt;   false,<br />	'where'         =&gt;  &quot;economics_categories&quot;,<br />    'limit'       =&gt; '4',<br />  ));<br />  $economic_newsRecord = @$economic_newsRecords[0]; // get first record<br /><br />?&gt;<br />&lt;?PHP  <br />  function maxWords($textOrHtml, $maxWords) { <br />    $text=str_replace(&quot;&lt;p&gt;&quot;,&quot;*P*&quot;,$textOrHtml); <br />    $text= str_replace(&quot;&lt;/p&gt;&quot;,&quot;*/P*&quot;,$text); <br />    $text = strip_tags($text);   <br />    $words = preg_split(&quot;/\s+/&quot;, $text, $maxWords+1);   <br />    if (count($words) &gt; $maxWords) { unset($words[$maxWords]); }   <br />    $output = join(' ', $words);   <br />    $output=str_replace(&quot;*P*&quot;,&quot;&lt;p&gt;&quot;,$output); <br />    $output=str_replace(&quot;*/P*&quot;,&quot;&lt;/p&gt;&quot;,$output); <br />    $output.=&quot;&lt;/p&gt;&quot;; <br /> <br />    return $output;   <br />  }   <br />?&gt;<br />&lt;?PHP <br />//  function maxWords($textOrHtml, $maxWords) {  <br />//  $text = strip_tags($textOrHtml);  <br />//  $words = preg_split(&quot;/\s+/&quot;, $text, $maxWords+1);  <br />//  if (count($words) &gt; $maxWords) { unset($words[$maxWords]); }  <br />//  $output = join(' ', $words);  <br />//  <br />//  return $output;  <br />//  }  <br />?&gt;<br />&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;<br />&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;<br />&lt;head&gt;<br />&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=UTF-8&quot; /&gt;<br />&lt;title&gt;Untitled Document&lt;/title&gt;<br />&lt;!-- css --&gt;<br />&lt;link href=&quot;css/bessemercity.css&quot; type=&quot;text/css&quot; rel=&quot;stylesheet&quot; /&gt;<br />&lt;!-- /css --&gt;<br />&lt;/head&gt;<br /><br />&lt;body&gt;<br />&lt;div id=&quot;content-container&quot;&gt;&lt;!-- content --&gt;<br />      &lt;?php foreach ($economicsRecords as $record): ?&gt;<br />      &lt;h1&gt;&lt;?php echo $economicsRecord['title'] ?&gt;&lt;/h1&gt;<br />	  &lt;p&gt;&lt;?php echo $record['content'] ?&gt;&lt;/p&gt;   <br />	  &lt;?php endforeach; ?&gt;&lt;!-- /content --&gt;<br />        <br />      &lt;div id=&quot;news-column&quot;&gt;<br />      &lt;!-- news column --&gt;<br />      &lt;?php foreach ($economic_newsFeaturedRecords as $record): ?&gt;<br />      &lt;h3&gt;&lt;a href=&quot;&lt;?php echo $record['_link'] ?&gt;&quot;&gt;&lt;?php echo $record['title'] ?&gt;&lt;/a&gt;&lt;/h3&gt;<br />      &lt;p&gt;&lt;?php echo date(&quot;F jS, Y&quot;, strtotime($record['date'])) ?&gt;&lt;br /&gt;<br />      &lt;?php echo maxWords($record['content'], 140); ?&gt;&lt;/p&gt;<br />      &lt;p&gt;&lt;a href=&quot;&lt;?php echo $record['_link'] ?&gt;&quot;&gt;Continue Reading...&lt;/a&gt;&lt;/p&gt;&lt;br /&gt;<br />      &lt;?php endforeach ?&gt; <br />      &lt;!-- /news column --&gt;&lt;/div&gt; <br />      <br />      &lt;div id=&quot;news-titles&quot;&gt;<br />      &lt;!-- news titles --&gt;<br />      &lt;?php foreach ($economic_newsRecords as $record): ?&gt;<br />      &lt;p&gt;&lt;strong&gt;&lt;a href=&quot;&lt;?php echo $record['_link'] ?&gt;&quot;&gt;&lt;?php echo $record['title'] ?&gt;&lt;/a&gt;&lt;/strong&gt;&lt;br /&gt;<br />      &lt;?php echo date(&quot;F jS, Y&quot;, strtotime($record['date'])) ?&gt;&lt;/p&gt;<br />      &lt;?php endforeach ?&gt; <br />      &lt;!-- /news titles --&gt; <br />      &lt;/div&gt;        <br /><br />    &lt;?php if (!$economicsRecords): ?&gt;<br />    &lt;h3&gt;There are no records.&lt;/h3&gt;&lt;?php endif ?&gt;   <br />    <br />&lt;!-- /content-container --&gt;&lt;/div&gt;<br /><br />&lt;/body&gt;<br />&lt;/html&gt;</code><br /><br /><b>Here's the html code as it was entered into the wysiwyg:</b><br /><code>&lt;p&gt;&lt;strong&gt;Ommy num quat, voluptat. Del in utpatem nulputatem dolobore molum vulput wiscili siscin hent nullandre magniam ilit nostrud ex eros duipsus cillaore tin ut iniat velenisci essi.&lt;/strong&gt;&lt;br /&gt;Modipsusci blan henisit la feugait lore minisci bla facipsum aliquat. Duisis augiam, velessim digna consenim verat. Minis auguerci eugait ulputat. Putpat. Nullaor sed et, quisl ut ute cortin henibh exeratum ipit veliquam veliquat, quamcor sed tet augait alis nostio consend reetue conse min ute tem zzrit nonum iustrud tie magna feummolore doloreetue tat in utpat numsandipsum do esecte mod dit diam, quat.&lt;/p&gt;<br />&lt;ul&gt;<br />&lt;li&gt;List item one&lt;/li&gt;<br />&lt;li&gt;List item two&lt;/li&gt;<br />&lt;li&gt;List item three&lt;/li&gt;<br />&lt;li&gt;List item four&lt;/li&gt;<br />&lt;/ul&gt;<br />&lt;p&gt;Ud tationsed tisl dolore feum dolor iurer sum inim ipismod ignibh et laore tisl etuer acil iurem iusto consequ amcommy niamet lum vel ip eliquipit la atummy nummy nisl delis estrud etum et, sum volore et veliquat, commolore commodo lortion sequatisit ipsummy nostrud tat. Iduis eu facilla faccum ero er si.&lt;/p&gt;</code><br /><br /><b>Here's the HTML I'm getting back on the site page:</b><br /><code>&lt;div id=&quot;news-column&quot;&gt;<br />&lt;!-- news column --&gt;<br />            &lt;h3&gt;&lt;a href=&quot;economic_news_details.php?Sample-23&quot;&gt;Economics Sample&lt;/a&gt;&lt;/h3&gt;<br />      &lt;p&gt;November 16th, 2010&lt;br /&gt;<br />      &lt;p&gt;Ommy num quat, voluptat. Del in utpatem nulputatem dolobore molum vulput wiscili siscin hent nullandre magniam ilit nostrud ex eros duipsus cillaore tin ut iniat velenisci <span style="color:red">essi.Modipsusci</span> blan henisit la feugait lore minisci bla facipsum aliquat. Duisis augiam, velessim digna consenim verat. Minis auguerci eugait ulputat. Putpat. Nullaor sed et, quisl ut ute cortin henibh exeratum ipit veliquam veliquat, quamcor sed tet augait alis nostio consend reetue conse min ute tem zzrit nonum iustrud tie magna feummolore doloreetue tat in utpat numsandipsum do esecte mod dit diam, quat.&lt;/p&gt;<span style="color:red"> List item one List item two List item three List item four </span>&lt;p&gt;Ud tationsed tisl dolore feum dolor iurer sum inim ipismod ignibh et laore tisl etuer acil iurem iusto consequ amcommy niamet lum vel ip eliquipit la atummy nummy nisl delis estrud etum et, sum volore et veliquat, commolore commodo lortion&lt;/p&gt;&lt;/p&gt;<br /><br />      &lt;p&gt;&lt;a href=&quot;economic_news_details.php?Sample-23&quot;&gt;Continue Reading...&lt;/a&gt;&lt;/p&gt;&lt;br /&gt;<br />       <br />&lt;!-- /news column --&gt;&lt;/div&gt;</code><br /><br /><b>Here's an example of what I'd like to get back as a result of the maxWords and article post. But this would require integrating the &lt;ul&gt; and &lt;li&gt; into the maxWords code I suspect.</b><br /><code>&lt;div id=&quot;news-column&quot;&gt;<br />&lt;!-- news column --&gt;<br />            &lt;h3&gt;&lt;a href=&quot;economic_news_details.php?Sample-23&quot;&gt;Economics Sample&lt;/a&gt;&lt;/h3&gt;<br />      &lt;p&gt;November 16th, 2010&lt;br /&gt;  <br />      &lt;p&gt;Ommy num quat, voluptat. Del in utpatem nulputatem dolobore molum vulput wiscili siscin hent nullandre magniam ilit nostrud ex eros duipsus cillaore tin ut iniat velenisci essi.&lt;br /&gt;Modipsusci blan henisit la feugait lore minisci bla facipsum aliquat. Duisis augiam, velessim digna consenim verat. Minis auguerci eugait ulputat. Putpat. Nullaor sed et, quisl ut ute cortin henibh exeratum ipit veliquam veliquat, quamcor sed tet augait alis nostio consend reetue conse min ute tem zzrit nonum iustrud tie magna feummolore doloreetue tat in utpat numsandipsum do esecte mod dit diam, quat.&lt;/p&gt;<br />&lt;ul&gt;<br />&lt;li&gt;List item one&lt;/li&gt;<br />&lt;li&gt;List item two&lt;/li&gt;<br />&lt;li&gt;List item three&lt;/li&gt;<br />&lt;li&gt;List item four&lt;/li&gt;<br />&lt;/ul&gt;<br />&lt;p&gt;Ud tationsed tisl dolore feum dolor iurer sum inim ipismod ignibh et laore tisl etuer acil iurem iusto consequ amcommy niamet lum vel ip eliquipit la atummy nummy nisl delis estrud etum et, sum volore et veliquat, commolore commodo lortion&lt;/p&gt;&lt;/p&gt;    <br />       <br />&lt;p&gt;&lt;a href=&quot;economic_news_details.php?Sample-23&quot;&gt;Continue Reading...&lt;/a&gt;&lt;/p&gt;&lt;br /&gt;<br />       <br />&lt;!-- /news column --&gt;&lt;/div&gt;</code><br /><br /><b>If using the &lt;ul&gt; and &lt;li&gt; in the maxWords is not possible, I'd like to just make the bullet list items change to the match the &lt;p&gt; paragraph so the text matches the rest of the article and flows naturally with the paragraph as if it was entered in the paragraph. And if there's a sentence that I or someone has used a &lt;br/&gt; break before starting the next sentence... the next sentence would have a space in between the previous sentence's period and the beginning of the next sentence.</b><br /><br /><b>Here's what I'd like the results to appear if it's not possible to show &lt;ul&gt;&lt;li&gt; within the maxWords. You'll see marked in green that there's a space between &quot;essi. Modipsusci&quot; and the &quot;List item one List item two List item three List item four&quot; are within the &lt;p&gt;&lt;/p&gt; tags and not excluded as they with the present state of the maxWords code.</b><br /><br /><code>&lt;div id=&quot;news-column&quot;&gt; <br />&lt;!-- news column --&gt; <br />            &lt;h3&gt;&lt;a href=&quot;economic_news_details.php?Sample-23&quot;&gt;Economics Sample&lt;/a&gt;&lt;/h3&gt; <br />      &lt;p&gt;November 16th, 2010&lt;br /&gt; <br />      &lt;p&gt;Ommy num quat, voluptat. Del in utpatem nulputatem dolobore molum vulput wiscili siscin hent nullandre magniam ilit nostrud ex eros duipsus cillaore tin ut iniat velenisci <span style="color:green">essi. Modipsusci</span> blan henisit la feugait lore minisci bla facipsum aliquat. Duisis augiam, velessim digna consenim verat. Minis auguerci eugait ulputat. Putpat. Nullaor sed et, quisl ut ute cortin henibh exeratum ipit veliquam veliquat, quamcor sed tet augait alis nostio consend reetue conse min ute tem zzrit nonum iustrud tie magna feummolore doloreetue tat in utpat numsandipsum do esecte mod dit diam, quat. <span style="color:green">List item one List item two List item three List item four</span> Ud tationsed tisl dolore feum dolor iurer sum inim ipismod ignibh et laore tisl etuer acil iurem iusto consequ amcommy niamet lum vel ip eliquipit la atummy nummy nisl delis estrud etum et, sum volore et veliquat, commolore commodo lortion&lt;/p&gt;&lt;/p&gt; <br /> <br />      &lt;p&gt;&lt;a href=&quot;economic_news_details.php?Sample-23&quot;&gt;Continue Reading...&lt;/a&gt;&lt;/p&gt;&lt;br /&gt; <br />        <br />&lt;!-- /news column --&gt;&lt;/div&gt;</code><br /><br />Thanks for your help Dave and let me know if there's anything else you need from me.<br />Zick<br />]]></description>
          <pubDate>Tue, 16 Nov 2010 18:08:35 -0800</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2208090#post2208090</guid>
        </item>
                <item>
          <title>Re: [zick] Limit amount of text shown</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2208082#post2208082</link>
          <description><![CDATA[Hi Zick,<br /><br />It can be tricky splitting up HTML content because you can end up with partial or incomplete html and spacing issues as you mention.<br /><br />If you can do the following, though, I can take a look and try to adjust your code:<br />- Post the function you want to use (which of the two?)<br />- Post a short snippet of HTML that demonstrates the problem.<br />- Post the HTML you are getting back<br />- Post the HTML you would like to get back instead.<br /><br />If you can do that it will make it easy for me to re-create the issue locally and suggest some code changes.<br /><br />Hope that helps!<br />]]></description>
          <pubDate>Tue, 16 Nov 2010 16:43:07 -0800</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2208082#post2208082</guid>
        </item>
                <item>
          <title>Re: [Dave] Limit amount of text shown</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2208080#post2208080</link>
          <description><![CDATA[Dave,<br />I've tried two different maxWord options, but neither seem to be working 100% for me. I've tried to explain my problem below, can you shed some light on what I need to do to get maxWords working for me?<br /><br />Using the code below works, up until there's a &lt;br/&gt; break or &lt;ul&gt;&lt;li&gt; bullet list. In the wysiwyg if there's a &lt;br/&gt; break to start a new sentence directly below the first, the &lt;br/&gt; break is lost and the new sentence does not have a space after the period where the first sentence ended and the new sentence begins. <b>Example (... this sentence has ended.This sentence has no space before previous sentence period.)</b><br /><br />And when there's a &lt;ul&gt; &lt;li&gt; bullet list the text within the bullet list looses it's paragraph formatting completely and the font style does not match any of the other article's font style using maxWords.<br /><br /><b>I've attached a snap shot with the problem areas highlighted.</b><br /><br /><span style="color:green">Code Option One:</span><br /><code>&lt;?PHP  <br />//  function maxWords($textOrHtml, $maxWords) { <br />//    $text=str_replace(&quot;&lt;p&gt;&quot;,&quot;*P*&quot;,$textOrHtml); <br />//    $text= str_replace(&quot;&lt;/p&gt;&quot;,&quot;*/P*&quot;,$text); <br />//    $text = strip_tags($text);   <br />//    $words = preg_split(&quot;/\s+/&quot;, $text, $maxWords+1);   <br />//    if (count($words) &gt; $maxWords) { unset($words[$maxWords]); }   <br />//    $output = join(' ', $words);   <br />//    $output=str_replace(&quot;*P*&quot;,&quot;&lt;p&gt;&quot;,$output); <br />//    $output=str_replace(&quot;*/P*&quot;,&quot;&lt;/p&gt;&quot;,$output); <br />//    $output.=&quot;&lt;/p&gt;&quot;; <br />// <br />//    return $output;   <br />//  }   <br />?&gt;</code><br /><br />So then I tried using the code below and that fixes the text font style formatting for &lt;ul&gt; &lt;li&gt; by eliminating it altogether and making it read as a sentence with the &lt;p&gt; paragraph style applied, But the problem I'm have with this is the if I have a &lt;br/&gt; break in the wysiwyg to start a new sentence directly below the previous sentence. The &lt;br/&gt; in the wysiwyg is lost and there's no space between the ending sentence's period and where the new sentence begins. <b>Example (... this sentence has ended.This sentence has no space before previous sentence period.)</b><br /><br /><span style="color:green">Code Option Two:</span><br /><code>&lt;?php <br />  // Usage: &lt; ?php print maxWords($content, 25); ? &gt; <br />  function maxWords($textOrHtml, $maxWords) { <br />  $text = strip_tags($textOrHtml); <br />  $words = preg_split(&quot;/\s+/&quot;, $text, $maxWords+1); <br />  if (count($words) &gt; $maxWords) { unset($words[$maxWords]); } <br />  $output = join(' ', $words); <br /> <br />  return $output; <br />  } <br />?&gt;</code><br /><br />Has anyone else had this problem using maxWords and does anyone know of a fix to get this working?<br />Thanks, Zick<br />]]></description>
          <pubDate>Tue, 16 Nov 2010 15:27:21 -0800</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2208080#post2208080</guid>
        </item>
                <item>
          <title>Re: [studio-a] Limit amount of text shown</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2195542#post2195542</link>
          <description><![CDATA[Hi studio-a, <br /><br />It's possible, but would require some custom coding.  What would code up next would be how to detect if there was more pages, displaying prev/next links, etc.  It gets a bit more complicated.  We could build something custom for you to do this if needed.  Feel free to email us if you'd like to discuss that more.<br /><br />Eric: Glad you got it figured out! :)<br /><br />Hope that helps!<br />]]></description>
          <pubDate>Fri, 30 Jan 2009 14:32:43 -0800</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2195542#post2195542</guid>
        </item>
                <item>
          <title>Re: [eduran582] Limit amount of text shown</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2195529#post2195529</link>
          <description><![CDATA[Dave, <br /><br />Disregard my request above...I went to the php link you gave and more or less found what I needed.  In a nutshell, I found and used the php <i>strrev</i> command to find what I needed: <br /><br />&lt;?php foreach (range(1,50) as $num): ?&gt;    <br />&lt;?php $stringA = $registrationRecord[&quot;list$num&quot;] ?&gt;<br />&lt;?php $toFind = &quot; &quot; ?&gt;<br />&lt;?php if ([url &quot;mailto:!@$registrationRecord[&quot;list$num&quot;]!@$registrationRecord[&quot;list$num[/url]&quot;]) { break; } ?&gt;    <br />&lt;option&gt;&lt;?php echo strrev( strchr(strrev($stringA),$toFind) ) ?&gt;&lt;br/&gt;&lt;/option&gt;<br />&lt;?php endforeach ?&gt; <br /><br />&lt;?php if (!$registrationRecord): ?&gt;<br />  (Pending)&lt;br/&gt;&lt;br/&gt;<br />&lt;?php endif ?&gt;<br /> <br /><br />Result displays just the date (&quot;Jan 29, 2009&quot;).  I had to make sure I stipulated in the instructions to the user to make sure there is a space after the date and before the slash. <br /><br />Hope I saved you some trouble.  It's not like you have anything else to do...  [;)] <br /><br />Eric<br />]]></description>
          <pubDate>Thu, 29 Jan 2009 21:35:18 -0800</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2195529#post2195529</guid>
        </item>
                <item>
          <title>Re: [studio-a] Limit amount of text shown</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2195520#post2195520</link>
          <description><![CDATA[Dave, <br /><br />I looked through the code and I'm pretty sure I understand how it works.  My question is within the substr function (I think) and would like to know if there's a way to search for a certain character (say, a slash) within the string and then display the contents up to that point.   <br /><br />I have a string with some text and I'd like to add some numbers after the text that would be separate from the first part.  The original text would be displayed one place and I'd like to display just the first part (up to the slash, in this case) in another area.  Example: complete text: &quot;Jan 29, 2009 /20&quot;, would like to display &quot;Jan 29, 2009&quot; in a separate area.  Do-able? <br /><br />Thanks. <br /><br />Eric<br />]]></description>
          <pubDate>Thu, 29 Jan 2009 14:50:16 -0800</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2195520#post2195520</guid>
        </item>
                <item>
          <title>Re: [Dave] Limit amount of text shown</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2195518#post2195518</link>
          <description><![CDATA[Hello, <br /><br />Thanks for the post, this works nice for abstracts and short news links.<br /><br />I wanted to extend this function to use within a Detail Page. For example, if an article has over 1500 words and I wanted to limit a Detail Page to only 500 words with an HTML link to continue reading the rest of the article. How can we limit the text for one page to continue with the remaining article text on a second or even third page via an HTML link “dynamically.” <br /><br />I have a feeling there has to be a different function to use within Detail Page 2 to pick up the word count from 501 to 1000 words, but I am not clear how to approach this problem. Is there another thread that covers this topic or can you point me in the right direction? <br /><br />Thanks for your help.<br />]]></description>
          <pubDate>Thu, 29 Jan 2009 13:26:39 -0800</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2195518#post2195518</guid>
        </item>
                <item>
          <title>Re: [grauchut] Limit amount of text shown</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2194238#post2194238</link>
          <description><![CDATA[Great!  Thanks for posting back and letting us know! :)<br />]]></description>
          <pubDate>Fri, 14 Nov 2008 18:34:50 -0800</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2194238#post2194238</guid>
        </item>
                <item>
          <title>Re: [Dave] Limit amount of text shown</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2194219#post2194219</link>
          <description><![CDATA[Dave sorry for the delay. It works great thanks again<br />]]></description>
          <pubDate>Thu, 13 Nov 2008 16:14:20 -0800</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2194219#post2194219</guid>
        </item>
                <item>
          <title>Re: [grauchut] Limit amount of text shown</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2194076#post2194076</link>
          <description><![CDATA[Yes, it goes at the top.  Here's an example:<br /><br /><code>&lt;?php<br /><br />  // Usage: &lt; ?php print maxWords($content, 25); ? &gt;<br />  function maxWords($textOrHtml, $maxWords) {<br />  $text = strip_tags($textOrHtml);<br />  $words = preg_split(&quot;/\s+/&quot;, $text, $maxWords+1);<br />  if (count($words) &gt; $maxWords) { unset($words[$maxWords]); }<br />  $output = join(' ', $words);<br /><br />  return $output;<br />  }<br />?&gt;<br /><br />&lt;?php<br />  $record['content'] = &quot;The quick brown fox jumps over the lazy dog.&quot;;<br />  echo maxWords($record['content'], 5);<br />?&gt;</code><br /><br />The first part goes at the top, the second part can go where ever you want.  Note that you don't need to set $record['content'] (or whatever your variable is named) if it's already set somewhere else.<br /><br />Hope that helps!<br />]]></description>
          <pubDate>Wed, 05 Nov 2008 14:42:57 -0800</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2194076#post2194076</guid>
        </item>
                <item>
          <title>Re: [Dave] Limit amount of text shown</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2194066#post2194066</link>
          <description><![CDATA[I tried the code and it didn't work. how does it go. Does the function go at the top? Sorry for being non php smart. Thanks Again <br /><br /><font size="3">// Usage: &lt; ?php print maxWords($content, 25); ? &gt; <br />function maxWords($textOrHtml, $maxWords) { <br /> $text  = strip_tags($textOrHtml); <br /> $words = preg_split(&quot;/\s+/&quot;, $text, $maxWords+1); <br /> if (count($words) &gt; $maxWords) { unset($words[$maxWords]); } <br /> $output = join(' ', $words); <br /> <br /> return $output; <br />}</font><br />]]></description>
          <pubDate>Tue, 04 Nov 2008 01:02:40 -0800</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2194066#post2194066</guid>
        </item>
                <item>
          <title>Re: [grauchut] Limit amount of text shown</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2194062#post2194062</link>
          <description><![CDATA[That code works on the word count.  So it shows the number of words you specify.<br />]]></description>
          <pubDate>Mon, 03 Nov 2008 20:38:09 -0800</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2194062#post2194062</guid>
        </item>
                <item>
          <title>Re: [Dave] Limit amount of text shown</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2194057#post2194057</link>
          <description><![CDATA[Dave will that code still show the text if it doesxn't reach the limit. Say the limit is 150 and the client only enters 100. Thanks<br />]]></description>
          <pubDate>Mon, 03 Nov 2008 16:18:48 -0800</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2194057#post2194057</guid>
        </item>
                <item>
          <title>Re: [grauchut] Limit amount of text shown</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2194052#post2194052</link>
          <description><![CDATA[I'm not sure because I didn't write that function.  You could check the comments or for other functions at the php.net link above.<br /><br />Also, here's a function I wrote for Donna that limits by words:<br /><br /><code>// Usage: &lt; ?php print maxWords($content, 25); ? &gt;<br />function maxWords($textOrHtml, $maxWords) {<br /> $text  = strip_tags($textOrHtml);<br /> $words = preg_split(&quot;/\s+/&quot;, $text, $maxWords+1);<br /> if (count($words) &gt; $maxWords) { unset($words[$maxWords]); }<br /> $output = join(' ', $words);<br /><br /> return $output;<br />}</code><br /><br />Maybe that one will work better?<br />]]></description>
          <pubDate>Mon, 03 Nov 2008 13:35:39 -0800</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2194052#post2194052</guid>
        </item>
                <item>
          <title>Re: [Dave] Limit amount of text shown</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2194029#post2194029</link>
          <description><![CDATA[Dave it works great thanks so much. One other question. If the content is shorter then the 150 limit it doesn't show anything. In that php function code is there a way to have it still show the content if it doesn;t meet the limit? Thanks again for your 100% customer support.<br />]]></description>
          <pubDate>Sat, 01 Nov 2008 07:57:50 -0700</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2194029#post2194029</guid>
        </item>
                <item>
          <title>Re: [grauchut] Limit amount of text shown</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2194021#post2194021</link>
          <description><![CDATA[Oh, yes you're right.  Drop the 0, try this:<br /><br />&lt;?php echo cutText($record['content'], 150); ?&gt;<br />]]></description>
          <pubDate>Fri, 31 Oct 2008 15:27:18 -0700</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2194021#post2194021</guid>
        </item>
                <item>
          <title>Re: [Dave] Limit amount of text shown</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2194019#post2194019</link>
          <description><![CDATA[Dave it doesn't show any text. Do I need to change any of the &quot;0&quot; in the code?<br />]]></description>
          <pubDate>Thu, 30 Oct 2008 23:26:27 -0700</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2194019#post2194019</guid>
        </item>
                <item>
          <title>Re: [grauchut] Limit amount of text shown</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2194013#post2194013</link>
          <description><![CDATA[You can put it at the top of the page, or anywhere before you call cutText().<br />]]></description>
          <pubDate>Thu, 30 Oct 2008 18:19:02 -0700</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2194013#post2194013</guid>
        </item>
                <item>
          <title>Re: [Dave] Limit amount of text shown</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2194004#post2194004</link>
          <description><![CDATA[Thanks Dave. Where do I place the php function code. <br /><br /><font size="3">&lt;?php <br /> <br />function cutText($string, $setlength) { <br />    $length = $setlength; <br />    if($length&lt;strlen($string)){ <br />        while (($string{$length} != &quot; &quot;) AND ($length &gt; 0)) { <br />            $length--; <br />        } <br />        if ($length == 0) return substr($string, 0, $setlength); <br />        else return substr($string, 0, $length); <br />    }else return $string; <br />} <br /> <br />?&gt;</font><br />]]></description>
          <pubDate>Thu, 30 Oct 2008 13:32:17 -0700</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2194004#post2194004</guid>
        </item>
                <item>
          <title>Re: [grauchut] Limit amount of text shown</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2193990#post2193990</link>
          <description><![CDATA[Hi Glenn,<br /><br />Often if you look in the comments on php.net for a function people will post other solutions for things like this. <br /><br />Check out <a target="_blank" href="http://www.php.net/substr">http://www.php.net/substr</a> (just replace substr to look up any other function)<br /><br />They have this one:<br /><br /><code>&lt;?php<br /><br />function cutText($string, $setlength) {<br />    $length = $setlength;<br />    if($length&lt;strlen($string)){<br />        while (($string{$length} != &quot; &quot;) AND ($length &gt; 0)) {<br />            $length--;<br />        }<br />        if ($length == 0) return substr($string, 0, $setlength);<br />        else return substr($string, 0, $length);<br />    }else return $string;<br />}<br /><br />?&gt;</code><br /><br />Which you could use like this:<br /><br />&lt;?php echo cutText($record['content'], 0, 150); ?&gt; <br /><br />Hope that helps!<br />]]></description>
          <pubDate>Thu, 30 Oct 2008 01:33:10 -0700</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2193990#post2193990</guid>
        </item>
                <item>
          <title>Limit amount of text shown</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2193980#post2193980</link>
          <description><![CDATA[I beleive I might have ask about this before but I noticed there are php codes to limit the amount of text that is shown with out having to set it in the cms builder itself. The only problem I have is it cuts the words off. Here is the code, is there a way to change it to show the full word and not cut it off thanks. <br /><br />&lt;?php echo substr($record['content'], 0, 150);?&gt;<br />]]></description>
          <pubDate>Wed, 29 Oct 2008 15:06:57 -0700</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2193980#post2193980</guid>
        </item>
              </channel>
    </rss>
  