cnl83 Posted June 16, 2009 Share Posted June 16, 2009 I have a some news that im loading into a cell. You can see the actual page here. (take a look at the section towards the bottom that says CHADS TEST). http://www.poshinteriors.com/09/news/ I only want to be able to display no more than 250 Characters. Does anyone know a nifty way to do this in a cell? <td height="110"></td> <td colspan="2" rowspan="2" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0" background="imported/news.gif"> <!--DWLayoutTable--> <tr> <td width="32" height="38"> </td> <td width="258"> </td> <td width="11"> </td> </tr> <tr> <td height="89"> </td> <td valign="top"><p align="left"><?php include_once( dirname(__FILE__) . '/fastnews-code.php' ); $fn = new fastNews(); echo $fn->display(); ?></a> </p></td> <td> </td> </tr> </table></td> Link to comment https://forums.phpfreaks.com/topic/162309-need-to-limit-the-amount-of-text-loaded-into-a-cell/ Share on other sites More sharing options...
Stephen Posted June 16, 2009 Share Posted June 16, 2009 I'm assuming: <?php include_once( dirname(__FILE__) . '/fastnews-code.php' ); $fn = new fastNews(); echo $fn->display(); ?> is the part that prints your news? If so, try using this: <?php include_once( dirname(__FILE__) . '/fastnews-code.php' ); $fn = new fastNews(); echo substr($fn->display(), 0, 250); ?> (note the substr) Link to comment https://forums.phpfreaks.com/topic/162309-need-to-limit-the-amount-of-text-loaded-into-a-cell/#findComment-856683 Share on other sites More sharing options...
cnl83 Posted June 16, 2009 Author Share Posted June 16, 2009 Yes, that is the code that displays the news, but the code you posted did not work. It actually cut the rest of the page off. Link to comment https://forums.phpfreaks.com/topic/162309-need-to-limit-the-amount-of-text-loaded-into-a-cell/#findComment-856687 Share on other sites More sharing options...
Stephen Posted June 16, 2009 Share Posted June 16, 2009 Oh yeah, I just looked at your html source and the php in that cell actually outputs: <SCRIPT LANGUAGE="JavaScript"> function fn_HideElement( elementName ){ ele = document.getElementById( elementName ); if( ! ele ){ alert( 'cannot find ' + elementName ); return; } ele.style.display = "none"; } function fn_ShowElement( elementName ){ ele = document.getElementById( elementName ); if( ! ele ){ alert( 'cannot find ' + elementName ); return; } ele.style.display = "block"; } </SCRIPT> <STYLE> ul#phpFastNews { list-style-type: none; margin: 0.5em 0; padding: 0; } ul#phpFastNews li { list-style-type: none; margin: 1em 0; padding: 0; } </STYLE> <UL ID="phpFastNews"> <A ID="fn-loginBar" HREF="#" ONCLICK="fn_ShowElement('fn-loginForm'); fn_HideElement('fn-loginBar'); return false;">Login</A> <LI ID="fn-addForm" STYLE="display: none;"> <H3>Add News Item</H3> <FORM METHOD="post" ACTION="http://www.poshinteriors.com/09/news/fastnews-code.php"> <INPUT TYPE="hidden" NAME="fn_action" VALUE="add"> <INPUT TYPE="text" SIZE="48" NAME="subject" VALUE="News Subject"><BR> <TEXTAREA ROWS="6" COLS="48" NAME="message">News Text</TEXTAREA><BR> <INPUT TYPE="submit" VALUE="Add"> </FORM> </LI> <LI ID="fn-loginForm" STYLE="display: none;"> <H3>Login</H3> <FORM METHOD="post" ACTION="http://www.poshinteriors.com/09/news/fastnews-code.php"> <INPUT TYPE="hidden" NAME="fn_action" VALUE="login"> Password: <INPUT TYPE="password" SIZE="24" NAME="password" VALUE=""><BR> <INPUT TYPE="submit" VALUE="Login"> </FORM> </LI> <LI ID="fn-view-2"> <H3>Chads Test</H3> <I>15 Jun 2009 5:54 pm</I> <BR> my Test <BR> </LI> <LI ID="fn-edit-2" STYLE="display: none;"> <H3>Edit News Item</H3> <FORM METHOD="post" ACTION="http://www.poshinteriors.com/09/news/fastnews-code.php"> <INPUT TYPE="hidden" NAME="fn_action" VALUE="update"> <INPUT TYPE="hidden" NAME="id" VALUE="2"> <INPUT TYPE="text" SIZE="48" VALUE="Chads Test" NAME="subject"><BR> <TEXTAREA ROWS="6" COLS="48" NAME="message">my Test</TEXTAREA><BR> <INPUT TYPE="submit" VALUE="Update"><BR> </FORM> </LI><LI ID="fn-view-1"> <H3>Today's Hot News</H3> <I>2 Sep 2008 4:43 pm</I> <BR> Hello! It is a really nice weather today. It is only getting better with phpFastNews script! Get it up and running in minutes! <BR> </LI> <LI ID="fn-edit-1" STYLE="display: none;"> <H3>Edit News Item</H3> <FORM METHOD="post" ACTION="http://www.poshinteriors.com/09/news/fastnews-code.php"> <INPUT TYPE="hidden" NAME="fn_action" VALUE="update"> <INPUT TYPE="hidden" NAME="id" VALUE="1"> <INPUT TYPE="text" SIZE="48" VALUE="Today's Hot News" NAME="subject"><BR> <TEXTAREA ROWS="6" COLS="48" NAME="message">Hello! It is a really nice weather today. It is only getting better with phpFastNews script! Get it up and running in minutes!</TEXTAREA><BR> <INPUT TYPE="submit" VALUE="Update"><BR> </FORM> </LI> <DIV STYLE="font-size: 0.75em; margin: 1em 0 0 0;">Powered by <A HREF="http://www.phpfastnews.com">phpFastNews</A> - fast and free news display script</DIV> </UL> I'm not sure where the actual news is outputted from. Link to comment https://forums.phpfreaks.com/topic/162309-need-to-limit-the-amount-of-text-loaded-into-a-cell/#findComment-856693 Share on other sites More sharing options...
cnl83 Posted June 16, 2009 Author Share Posted June 16, 2009 I hate to sound mentally challenged, but what do I do with that code? Link to comment https://forums.phpfreaks.com/topic/162309-need-to-limit-the-amount-of-text-loaded-into-a-cell/#findComment-856699 Share on other sites More sharing options...
cnl83 Posted June 16, 2009 Author Share Posted June 16, 2009 The data is saved into a text file. I guess it would be easier to load it directly from the text file, right? Link to comment https://forums.phpfreaks.com/topic/162309-need-to-limit-the-amount-of-text-loaded-into-a-cell/#findComment-856703 Share on other sites More sharing options...
cnl83 Posted June 16, 2009 Author Share Posted June 16, 2009 nm Link to comment https://forums.phpfreaks.com/topic/162309-need-to-limit-the-amount-of-text-loaded-into-a-cell/#findComment-856709 Share on other sites More sharing options...
cnl83 Posted June 17, 2009 Author Share Posted June 17, 2009 I still dont have this figured out.. Any more help? Link to comment https://forums.phpfreaks.com/topic/162309-need-to-limit-the-amount-of-text-loaded-into-a-cell/#findComment-858251 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.