Re: Incorrect newline counters
messju mohr <[email protected]>
| Newsgroups | gmane.comp.php.smarty.devel |
|---|---|
| Message-ID | <[email protected]> |
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.
--
Smarty Development Mailing List (http://smarty.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php