Re: Count Characters
This WebDNA talk-list message is from 2005
It keeps the original formatting.
numero = 63431
interpreted = N
texte = If your [news_body] contains comparison characters (!, =, <, >, etc) that will foul up your [hideif [news_body]=] tag - url'ing [news_body] there ([hideif [url][news_body][/url]=]) will help.Also, if your [news_body] contains HTML code, you may be truncating it in a bad place resulting in invalid HTML - use [removehtml] to strip the HTML before processing it if that's a problem.Brian FriesBrainScan SoftwareOn Nov 17, 2005, at 11:05 AM, David Bastedo wrote:>>> ---------------------------------------------------------------> David Bastedo> Ten Plus One Communications> 416.603.2223x1> http://www.10plus1.com>> Hi: my first post in a LONG time, though I have been learning lots > from> all of you. Thanks.>> I am building an archive of sorts and people paste in text to a > text box> and I store it. Well, that's the basics.>> Anyways, when I display the text, I often want to show the first 500> characters and then display a click for more info button etc.>> So, the code I have written seems to work only part of the time and I> can't figure out what's amiss.>> I count the total characters in the entry, see if it is over a max, if> it is, then I show the first x (500) characters with the more button.>> The problem, is even though the code shows let's sat 1500 > characters, it> will not register the [body_text] tag as having content, and shows > it as> being empty, even though I know it has content. When I click to > view the> entry, the text comes up, but I can't seems to definitively show the> first 500 characters . . .>> [math show=F]MyTotal=[CountChars][unurl][convertchars> db=databases/customConvert.db][news_body][/convertchars][/unurl][/ > CountC> hars][/math]>> [showif [MyTotal]>[MyTextMax]]> [text]MyBody=[GetChars> start=1&end=500][unurl][convertchars> db=databases/customConvert.db][news_body][/convertchars][/unurl][/ > GetCha> rs]...
[/text]> [/showif]>> [showif [MyTotal]<[MyTextMax]]> [text]MyBody=[GetChars> start=1&end=[MyTotal]][unurl][convertchars> db=databases/customConvert.db][news_body][/convertchars][/unurl][/ > GetCha> rs]
[/text]> [/showif]>> [hideif [news_body]=]
Body: [unurl> ][convertchars> db=databases/customConvert.db][news_body][/convertchars][/unurl] >
> [/hideif]>>> thanks in advance.>> D.-------------------------------------------------------------This message is sent to you because you are subscribed to the mailing list
.To unsubscribe, E-mail to: To switch to the DIGEST mode, E-mail to Web Archive of this list is at: http://webdna.smithmicro.com/
Associated Messages, from the most recent to the oldest:
If your [news_body] contains comparison characters (!, =, <, >, etc) that will foul up your [hideif [news_body]=] tag - url'ing [news_body] there ([hideif [url][news_body][/url]=]) will help.Also, if your [news_body] contains HTML code, you may be truncating it in a bad place resulting in invalid HTML - use [removehtml] to strip the HTML before processing it if that's a problem.Brian FriesBrainScan SoftwareOn Nov 17, 2005, at 11:05 AM, David Bastedo wrote:>>> ---------------------------------------------------------------> David Bastedo> Ten Plus One Communications> 416.603.2223x1> http://www.10plus1.com>> Hi: my first post in a LONG time, though I have been learning lots > from> all of you. Thanks.>> I am building an archive of sorts and people paste in text to a > text box> and I store it. Well, that's the basics.>> Anyways, when I display the text, I often want to show the first 500> characters and then display a click for more info button etc.>> So, the code I have written seems to work only part of the time and I> can't figure out what's amiss.>> I count the total characters in the entry, see if it is over a max, if> it is, then I show the first x (500) characters with the more button.>> The problem, is even though the code shows let's sat 1500 > characters, it> will not register the [body_text] tag as having content, and shows > it as> being empty, even though I know it has content. When I click to > view the> entry, the text comes up, but I can't seems to definitively show the> first 500 characters . . .>> [math show=F]MyTotal=[countchars][unurl][convertchars> db=databases/customConvert.db][news_body][/convertchars][/unurl][/ > CountC> hars][/math]>> [showif [MyTotal]>[MyTextMax]]> [text]MyBody=[GetChars> start=1&end=500][unurl][convertchars> db=databases/customConvert.db][news_body][/convertchars][/unurl][/ > GetCha> rs]...
[/text]> [/showif]>> [showif [MyTotal]<[MyTextMax]]> [text]MyBody=[GetChars> start=1&end=[MyTotal]][unurl][convertchars> db=databases/customConvert.db][news_body][/convertchars][/unurl][/ > GetCha> rs]
[/text]> [/showif]>> [hideif [news_body]=]Body: [unurl> ][convertchars> db=databases/customConvert.db][news_body][/convertchars][/unurl] >
> [/hideif]>>> thanks in advance.>> D.-------------------------------------------------------------This message is sent to you because you are subscribed to the mailing list .To unsubscribe, E-mail to: To switch to the DIGEST mode, E-mail to Web Archive of this list is at: http://webdna.smithmicro.com/
Brian Fries
DOWNLOAD WEBDNA NOW!
Top Articles:
Talk List
The WebDNA community talk-list is the best place to get some help: several hundred extremely proficient programmers with an excellent knowledge of WebDNA and an excellent spirit will deliver all the tips and tricks you can imagine...
Related Readings:
I have observed and I am gone. (1998)
Lookup command (1998)
space at start of menu (2000)
shipping costs (1998)
is [Bankres] an internal webcat variable? (1999)
acgi to plugin migration problems (2000)
Cancel Subscription (1996)
Sorting... stumped. (2006)
WSDL Wizard (2003)
Virtual Postcard almost complete... (1998)
Help! WebMerchant store suddenly won't process orders... (2001)
[ShowIf] if the varieable exists (1998)
# fields limited? (1997)
Listserver problem (1997)
pull downs (1997)
Forms Search Questions (1997)
Variables not being passed *back* (2000)
Add message to Order (1997)
Sorting Numbers (1997)
[WebDNA] unix timestamp in WebDNA (2009)