Re: HTML_Template_Sigma: Linebreak control

From: Date: Sat, 15 Jul 2006 07:31:10 +0000
Subject: Re: HTML_Template_Sigma: Linebreak control
References: 1 2 3  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-24658@lists.php.net to get a copy of this message
> Le vendredi 14 juillet 2006 18:59, Markus Ernst a écrit : > Raphaël Gertz schrieb: > > in theory the template is rendered like it is without template block > > code. So I think that simply move your template to this will be enough : > > <!-- BEGIN title_block -->-+-+-+-+- > > > > {title} > > > > -+-+-+-+-<!-- END title_block --><!-- BEGIN hello_block --> > > > > Hello {firstname} {lastname}<!-- END hello_block --><!-- BEGIN > > element_block --><!-- BEGIN subtitle_block --> > > > > > > -+-+-+-+- > > > > {subtitle}<!-- END subtitle_block --> > > > > {text}<!-- END element_block --> > > > > That way you will not have extra new lines problem > > (I does that like that). > > I did it like this before, but as this is intended to be used by people > acting rather intuitively I would like it to behave intuitively! :-) > > > Anyway sigma is a HTML package so it's done to display html, use it for > > plain text is a hack ;) > > But you are maybe right, an option to handle the new line whould be > > great. > > > > ps : you may deal with sigma block detection and add the extra \n in the > > detection string maybe it should solve your problem ;) > > I tried this and found it useful! So I submitted it as a feature request. > > I even thought about introducing a 'trim_mode' option, with options such > as: - 'all' (default, acts as the current version) > - 'space' (removes all kinds of white space by a single space, useful > for HTML) > - 'light' (removes only the line breaks caused by block tags, useful for > plain text) > > Anyway this would mean rewriting the whole trimming stuff, as trimming > has no effect when the template is called for the first time. If you may add to keeps the identation (in tabulation) that may be cool too ;) (in fact I keep the tabulation between the html tags to help debugging the rendering engine. But for final html code it's useless...

Attachment: [application/pgp-signature]
« previous php.pear.general (#24658) next »