Re: HTML_Template_Sigma: Linebreak control

From: Date: Fri, 14 Jul 2006 12:19:33 +0000
Subject: Re: HTML_Template_Sigma: Linebreak control
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-24647@lists.php.net to get a copy of this message
> Le vendredi 14 juillet 2006 14:04, Markus Ernst a écrit : > Hi > > In a template for the plain text section of a newsletter e-mail, it > looks for example like this: > > > <!-- 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 --> > > > > Now, in default state, Sigma will trim all empty lines off. If I set the > trim_on_save option to false, there will be too many empty lines, as the > block defining lines seem to keep their newlines. > > I also want to leave the block structure, as there might be some > variables not filled, and then I don't want according space and > separator elements to be rendered. > > Is there a way to take full control of the newlines generated? (Without > tricky template hacks... as template creation should be possible for > people with little coding experience). > > Thanks for a comment! > Markus 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). 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 ;)

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