Re: HTML_Template_Sigma: Linebreak control
| From: | Markus Ernst | Date: | Fri, 14 Jul 2006 16:59:15 +0000 |
| Subject: | Re: HTML_Template_Sigma: Linebreak control | ||
| References: | 1 2 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-24652@lists.php.net to get a copy of this message | ||
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. Thanks for your ideas! Markus