Re: [SMARTY-DEV] Newlines

From: Date: Thu, 04 Apr 2002 04:09:04 +0000
Subject: Re: [SMARTY-DEV] Newlines
References: 1  Groups: php.smarty.dev 
Request: Send a blank email to php-smarty-dev+get-13@lists.php.net to get a copy of this message
From an earlier email that Jimmy sent to the list: $this->_parse_vars_props($tag_command); return "<?php echo $tag_command[0]; ?>"; <<<<<<<< I REMOVED the \n at the end } there is a newline placed after the variable, which isnt normally affected in displaying the page, but combined with the trimwhitespace postfilter it removes the space from the start of the next line. -bok On 4/4/02 12:16 AM, Monte Ohrt wrote the following: > Hmm, trimwhitespace should only trim space out from the beginning and > ends of lines, from from between something like "{$var} text" > > Is that not the case? > > > Jason Sweat wrote: >> I did some further testing because I encountered the same problem. It has >> to do with postfilter.trimwhitespace.php >> No postfilter, no problem. Or as another temporary solution if you want to >> keep the postfilter, hard code a non-breaking space in between the var and >> the text (i.e. {$var} &nbsp; text). I am not sufficiently adept with regexp >> to solve the problem, but at least it is better identified. >> >> Jason >> >> >> ----- Original Message ----- >> From: "Monte Ohrt" <monte@ispi.net> >> To: "Jimmy Harlindong" <jimmy@harlindong.com> >> Cc: <smarty-dev@lists.php.net> >> Sent: Tuesday, April 02, 2002 9:11 AM >> Subject: Re: [SMARTY-DEV] Newlines >> >> >> >>> I cannot reproduce this problem. Here is my simple test: >>> >>> index.tpl >>> --------- >>> >>> begin >>> >>> TESTING {$var} test >>> >>> TESTING2 {$var} >>> test >>> >>> done >>> >>> >>> OUTPUT >>> ------ >>> >>> begin >>> >>> TESTING foo test >>> >>> TESTING2 foo >>> test >>> >>> done >>> >>> >>> >>> This is exactly the output I would expect. Something else must be >>> affecting the output. Are you putting strip around this, or do you have >>> pre/post filters that may affect it? strip would take carriage returns >>> off of the beginning and ends of lines, but it should not affect "{$var} >>> text" if they are together. >>> >>> >>> >>> Jimmy Harlindong wrote: >>> >>>> When I have $var = "abc" and inside the template: {$var} text >>>> the output will be "abctext" >>>> >>>> How do I make it into "abc text" (with space there) >>>> >>>> On another case: >>>> get "abctext" only when I write {$var}text in the template? >>>> >>>> This seems to work: >>>> >>>> Smarty_compiler.class.php >>>> >>>> inside _compile_tag() function: >>>> >>>> /* If the tag name matches a variable or section property >>>> definition, >>>> we simply process it. */ >>>> if >>>> >>>> (preg_match('!^\$\w+(?>(\[(\d+|\w+(\.\w+)?)\])|((\.|->)\w+))*(?>\|@?\w+( >>>> :(?>' . $qstr_regexp . '|[^|]+))*)*$!', $tag_command) || // if >>>> a >>>> variable >>>> preg_match('!^#(\w+)#(?>\|@?\w+(:(?>' . $qstr_regexp . >>>> '|[^|]+))*)*$!', $tag_command) || // or a configuration variable >>>> preg_match('!^%\w+\.\w+%(?>\|@?\w+(:(?>' . $qstr_regexp >>>> . >>>> '|[^|]+))*)*$!', $tag_command)) { // or a section property >>>> settype($tag_command, 'array'); >>>> $this->_parse_vars_props($tag_command); >>>> return "<?php echo $tag_command[0]; ?>"; >>>> <<<<<<<< I REMOVED >>>> the \n at the end >>>> } >>>> >>>> >>>> Any comments? Or perhaps there is a workaround to this problem? >>>> >>>> >>> >>> >>> >>> -- >>> Monte Ohrt <monte@ispi.net> >>> Director of Technology, ispi Inc. >>> >>> >>> -- >>> Smarty Development Mailing List (http://smarty.php.net/) >>> To unsubscribe, visit: http://www.php.net/unsub.php >>> >> >> >> > >

« previous php.smarty.dev (#13) next »