WebGUI
      Click here to register.
      
PBWG Banner

HTML filter macro

User: arjan
Date: 10/18/2007 4:52 pm
Views: 459
Rating: -3    Rate [
|
]

In response to djs' question if anybody had ever written a macro that can stip HTML from a template-variable.

Here it is: filter.pm. 

I use it in the recovery template like this:

<tmpl_if recoverMessage>^filter(<tmpl_var recoverMessage>);</tmpl_if>

I don't expect it to work well always, since macro's in general don't handle quotes well. I've not used or tested this macro in any other other way than above.  

 usage:

process ( html, [filter] )

       I use this macro in the Password Recovery Template. Here the variable <tmpl_var recoverMessage> returns
       <ul><li><li> which produces empty bullets. The reason for this is that line 73 of Auth/WebGUI.pm adds
       list-tags ($error .= ’<li>’.$i18n->get(3).’</li>’;) and line 727 of the same module too. ($self->recov‐
       erPassword(’<ul><li>’.$self->error.’</li></ul>’); The real solution would be to change Auth/WebGUI.pm. (In fact I now see this has happend.)

      This macro is in fact an interface to WebGUI::HTML::filter.

       The filter chosen is "all" from the following in HTML::filter: Choose from "all", "none", "macros",
       "javascript", or "most". Defaults to "most". "all" removes all HTML tags and macros; "none" removes no
       HTML tags; "javascript" removes all references to javacript and macros; "macros" removes all macros, but
       nothing else; and "most" removes all but simple formatting tags like bold and italics.



Replies

PreviousBackNext