By: RwD
Date: 2005-03-08
Time: 14:58
|
[ request ] strip html elements (plaintext)
Would it be possible to have tbs retrieve text as plain-text? (assuming the database stored text with some html formatting)
I realize this would screw up tables and stuff but it is usefull for showing sections of text inside an administration page without breaking the string at a random point fucking up my code.
I don't mind using an onformat function for this one, but ofcourse -alike a child- I want to have more, bigger and better ;)
(This is just something I came across a second ago or so, and I am writing the function after I post this text)
|
By: Skrol29
Date: 2005-03-08
Time: 15:02
|
Re: [ request ] strip html elements (plaintext)
You can do it with htmlconv=no;protect=no
|
By: RwD
Date: 2005-03-08
Time: 15:07
|
Re: [ request ] strip html elements (plaintext)
No, I am also using max=100.
The actual problem I am having is that the text potentially gets cut of in the middle of a table or whatever element (and this happens quite often). So I want to take out all html elements, then cut the string to the right length.
|
By: RwD
Date: 2005-03-08
Time: 15:12
|
Re: [ request ] strip html elements (plaintext)
This is basically what I am doing now:
php: function stripHTML( $FieldName, &$CurrVal )
{
$CurrVal = ereg_replace( '<[^>]+>', '', $CurrVal );
} |
html: [overview.section_content; htmlconv=no; max=100; onformat=stripHTML;.] |
|
By: Skrol29
Date: 2005-03-08
Time: 15:16
|
Re: [ request ] strip html elements (plaintext)
This is smart, why don't you like it?
I'm afraid a special feature for that is a bit too specific.
|
By: RwD
Date: 2005-03-08
Time: 15:33
|
Re: [ request ] strip html elements (plaintext)
Well this is something specific to the designer if he or she wishes to have html data in there. In this case I am the designer as this goes into the admin page. But on the user side I am only developing and maintaining the phpscripts (and I set up all the templates, but won't be maintaining them)
Ofcourse I can use this function and the above reason is probably not enough to put it in for you then I guess. But I figured you have htmlconv=yes, no, nobr, wsp, look, esc. So the option noels (not a name :P) would not be that different, but along the same thing.
|
By: Skrol29
Date: 2005-03-09
Time: 13:10
|
Re: [ request ] strip html elements (plaintext)
That's true that they are many options for htmlconv. I regret now the option thmlconv=look, but I've noticed that it's used many times by users. So I have to keep it for compatibility. I can't add many other options, it has a cost in terms of time execution. The one existing seems specific but not that much: they are very useful when you code pages with messages (forum, news,...). Options for specific or combined purpose should better be coded using 'onformat'.
By the way, there is a plan to add a parameter $PrmLst on the OnFormat user function. This will give the list of parameters of the field, so programmers can use it in the code.
|
By: RwD
Date: 2005-03-09
Time: 13:13
|
Re: [ request ] strip html elements (plaintext)
Now that would be usefull. It basically means I can make up my own parameters to be used on specific fields :P
|
|
Posting in progress.
Please wait...
|