Using CF to restrict characters displayed in CFOutput
Hi In my CF Output how can I restrict for example the contents of #output# from the database to the first 200 characters ? TIA ~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:216151 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: Using CF to restrict characters displayed in CFOutput
Assuming you're outputting a string called stringvar, You can use left(stringvar, 200) if you dont care if a word is cut in half, but if you want it to get only complete words up to a max of 200 characters, there's a cool UDF you can get from the library at CFLIB.ORG (http://www.cflib.org) called FullLeft. It takes the number of characters you specify, then truncates a little more until it comes to a space. Then you'll display 190, 195 chars etc but only whole words. Cheers Mike Kear Windsor, NSW, Australia Certified Advanced ColdFusion Developer AFP Webworks http://afpwebworks.com ColdFusion, PHP, ASP, ASP.NET hosting from AUD$15/month On 8/24/05, Ian Vaughan [EMAIL PROTECTED] wrote: Hi In my CF Output how can I restrict for example the contents of #output# from the database to the first 200 characters ? TIA ~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:216153 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
RE: Using CF to restrict characters displayed in CFOutput
Thanks for the UDF Mike - works just as I want it to. -Original Message- From: Mike Kear [mailto:[EMAIL PROTECTED] Sent: 24 August 2005 09:00 To: CF-Talk Subject: Re: Using CF to restrict characters displayed in CFOutput Assuming you're outputting a string called stringvar, You can use left(stringvar, 200) if you dont care if a word is cut in half, but if you want it to get only complete words up to a max of 200 characters, there's a cool UDF you can get from the library at CFLIB.ORG (http://www.cflib.org) called FullLeft. It takes the number of characters you specify, then truncates a little more until it comes to a space. Then you'll display 190, 195 chars etc but only whole words. Cheers Mike Kear Windsor, NSW, Australia Certified Advanced ColdFusion Developer AFP Webworks http://afpwebworks.com ColdFusion, PHP, ASP, ASP.NET hosting from AUD$15/month On 8/24/05, Ian Vaughan [EMAIL PROTECTED] wrote: Hi In my CF Output how can I restrict for example the contents of #output# from the database to the first 200 characters ? TIA ~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:216155 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54