Re: [SMARTY-DEV] Incorrect newline counters

From: Date: Sun, 30 May 2004 00:59:09 +0000
Subject: Re: [SMARTY-DEV] Incorrect newline counters
References: 1  Groups: php.smarty.dev 
Request: Send a blank email to php-smarty-dev+get-2328@lists.php.net to get a copy of this message
Hi Dmitry, this is a topic which has been raised before, but I am unable to find the resolving email given at the time, so I will have to rely on my memory of the situation. Basically, the smarty templates are geared so the resulting output is the same as the template, and is a higher priority than the compiled template itself. There is (or used to be at least) a problem where php would strip off carriage returns/newlines following a closing php tag. This means that everytime you call a template variable, you'd lose a line in your output. Smarty counters this by adding an additional newline after the close of the tag, so that the output returns the same as the template itself. Now it could be that this situation has changed in recent releases of PHP, or that my memory is slightly faulty (in which case one of the others is more than welcome to step in and correct me), but I do know there is a good reason that the compiled templates come out with different line numbers to the template itself, and that this has been raised before, and answered, so a more thorough check of the list archives should reveal the answer. Regards, -bok At 05:39 AM 30/05/2004, you wrote:
Hello. Smarty do not preserve line numbers while compiling the template. When an error occurs, PHP shows line number in compiled file, and it does not correspond line number in the source template. Example. If I have the following template: 1 {t_block name="Title"}...{/t_block} 2 {t_block name="Author"}...{/t_block} 3 {t_block name="Text"} 4 {strip} 5 ss 6 ddd 7 {/strip} 8 {$a} and $a is undefined, I get notice not in line 8, but in other. Resulting template contains: a) superfluous \n's - in the headder comments /* compiled from ...*/, and after plugins require_once's; b) insufficient spaces - {strip} processed incorrectly, it glues its body, replacing \n by '', but not by <?php\n?> What do you thing about all that? If I write the patch which will correct line numbers, will you include it in production version? -- Best regards, Dmitry Koteroff. -- Smarty Development Mailing List (http://smarty.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php


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