Not sure if this helps but I use it in a news page where the user gets, in my case, the first 150 characters but trimmed to the nearest full word.
[if [countchars][mySTORY][/countchars]>150][then][listwords delimiters= &words=[url][getchars start=1&end=150][mySTORY][/getchars][/url]][text]word[math][index]+1[/math]=[word][/text][text]word[index][/text] [/listwords]<a href="myMoreLink" >(Click for more...)</a>[/then][else][mySTORY][/else][/if]
Hope it helps.
Cheers========================================Steve Craig - Asylum Interactive LtdTel +44 1330 860550 Fax +44 1330 860880========================================Email: steve@asylumweb.comSkype: s.craig - iChat: steve.craig========================================
On 10 May 2011, at 00:22, Stuart Tremain wrote:
It just autowraps in the div so there is no specific marker to use.--------------------------------------------------------- This message is sent to you because you are subscribed to the mailing list
I have a div with text loaded from a database in it. I have no control over the length of the text and want to calculate or count the number of lines it wraps to so I can hide all except a small segment at the beginning until a user clicks on "more".
I am using a show more link to expand the div to show the rest of the text but if there is not enough text, there is no need to show the "show more"
Here's is an example of what I am doing:In this case the "more info" is required
But here it is not, I need a way of determining if it needs to be shown, counting chars is not accurate enough.
On 09/05/2011, at 9:40 PM, William DeVaul wrote:
What defines the lines? Is it something like counting 80 characters
or carriage returns?
On Mon, May 9, 2011 at 7:07 AM, Stuart Tremain <webdna@idfk.com.au> wrote:
I have a problem where I need to count the lines of text in a <DIV>, the contents are dynamic from a DB.
Any ideas ?
Regards
Stuart Tremain
IDFK Web Developments
AUSTRALIA
webdna@idfk.com.au
---------------------------------------------------------
This message is sent to you because you are subscribed to
the mailing list <talk@webdna.us>.
To unsubscribe, E-mail to: <talk-leave@webdna.us>
archives: http://mail.webdna.us/list/talk@webdna.us
Bug Reporting: support@webdna.us
---------------------------------------------------------
This message is sent to you because you are subscribed to
the mailing list <talk@webdna.us>.
To unsubscribe, E-mail to: <talk-leave@webdna.us>
archives: http://mail.webdna.us/list/talk@webdna.us
Bug Reporting: support@webdna.us
. To unsubscribe, E-mail to: archives: http://mail.webdna.us/list/talk@webdna.us Bug Reporting: support@webdna.us
--------------------------------------------------------- This message is sent to you because you are subscribed to the mailing list. To unsubscribe, E-mail to: archives: http://mail.webdna.us/list/talk@webdna.us Bug Reporting: support@webdna.us
|
Not sure if this helps but I use it in a news page where the user gets, in my case, the first 150 characters but trimmed to the nearest full word.
[if [countchars][mySTORY][/countchars]>150][then][listwords delimiters= &words=[url][getchars start=1&end=150][mySTORY][/getchars][/url]][text]word[math][index]+1[/math]=[word][/text][text]word[index][/text] [/listwords]<a href="myMoreLink" >(Click for more...)</a>[/then][else][mySTORY][/else][/if]
Hope it helps.
Cheers========================================Steve Craig - Asylum Interactive LtdTel +44 1330 860550 Fax +44 1330 860880========================================Email: steve@asylumweb.comSkype: s.craig - iChat: steve.craig========================================
On 10 May 2011, at 00:22, Stuart Tremain wrote:
It just autowraps in the div so there is no specific marker to use.--------------------------------------------------------- This message is sent to you because you are subscribed to the mailing list
I have a div with text loaded from a database in it. I have no control over the length of the text and want to calculate or count the number of lines it wraps to so I can hide all except a small segment at the beginning until a user clicks on "more".
I am using a show more link to expand the div to show the rest of the text but if there is not enough text, there is no need to show the "show more"
Here's is an example of what I am doing:In this case the "more info" is required
But here it is not, I need a way of determining if it needs to be shown, counting chars is not accurate enough.
On 09/05/2011, at 9:40 PM, William DeVaul wrote:
What defines the lines? Is it something like counting 80 characters
or carriage returns?
On Mon, May 9, 2011 at 7:07 AM, Stuart Tremain <webdna@idfk.com.au> wrote:
I have a problem where I need to count the lines of text in a <DIV>, the contents are dynamic from a DB.
Any ideas ?
Regards
Stuart Tremain
IDFK Web Developments
AUSTRALIA
webdna@idfk.com.au
---------------------------------------------------------
This message is sent to you because you are subscribed to
the mailing list <talk@webdna.us>.
To unsubscribe, E-mail to: <talk-leave@webdna.us>
archives: http://mail.webdna.us/list/talk@webdna.us
Bug Reporting: support@webdna.us
---------------------------------------------------------
This message is sent to you because you are subscribed to
the mailing list <talk@webdna.us>.
To unsubscribe, E-mail to: <talk-leave@webdna.us>
archives: http://mail.webdna.us/list/talk@webdna.us
Bug Reporting: support@webdna.us
. To unsubscribe, E-mail to: archives: http://mail.webdna.us/list/talk@webdna.us Bug Reporting: support@webdna.us
--------------------------------------------------------- This message is sent to you because you are subscribed to the mailing list. To unsubscribe, E-mail to: archives: http://mail.webdna.us/list/talk@webdna.us Bug Reporting: support@webdna.us
DOWNLOAD WEBDNA NOW!
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...