Re: [SMARTY-DEV] Incorrect newline counters

From: Date: Mon, 31 May 2004 06:12:10 +0000
Subject: Re: [SMARTY-DEV] Incorrect newline counters
References: 1 2 3  Groups: php.smarty.dev 
Request: Send a blank email to php-smarty-dev+get-2339@lists.php.net to get a copy of this message
On Mon, May 31, 2004 at 03:31:23AM +0400, Dmitry Koteroff wrote: > RA> Basically, the smarty templates are geared so the resulting > RA> output is the same as the template, and is a higher priority > RA> than the compiled template itself. > Aargh! > > What do I see in _compile_foreach_start(), for example? > > $output .= "if (isset(\$this->_foreach[$name])) > unset(\$this->_foreach[$name]);\n"; > $foreach_props = "\$this->_foreach[$name]"; > > WHAT IS THIS? Why \n? It breaks line number! yes, but nobody here does really seem to care, except of you. > Now I write the patch which does TOTALLY remove ALL \n's from > compiled tag and after that adds needed "<?php\n?>" to correct > line counter. Piece of code: > > + $lT = substr_count($template_tags_sp[$i], "\n"); > + $lC = substr_count($compiled_tags[$i], "\n"); > + $compiled_tags[$i] = preg_replace('/\n+/s', ' ', > $compiled_tags[$i]); > + $compiled_tags[$i] .= str_repeat("<?php\n?".">", > max($lT-$lC, 0)); > > I am too lazy to delete all \n's from hundreds of lines of code > manually - do it yourself if you want. Why have you inserted them > to the code at all? i guess they are to improve readability to make the compiled templates easier to debug. line-numbers are not everthing. greetings messju > -- > Best regards, > Dmitry Koteroff.

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