Re: Incorrect newline counters

Monte Ohrt <[email protected]>
Newsgroups gmane.comp.php.smarty.devel
Message-ID <[email protected]>
The important thing here is that the template source matches _exactly_ 
to the template output, which includes newlines. This may not be so 
important with HTML output, but things like e-mail templates it is crucial.

PHP's behavior is to eat newline characters after ?> tags. This is fine 
for your typical imbedded HTML programs, but for template engines like 
Smarty it causes problems. Therefore to make template output identical 
to template source, a lot of careful work was done to add newline 
characters after ?> tags to essentially "undo" this PHP feature. When 
you say you remove unnecessary \n's, this leads me to think it will 
break output, meaning it will butt lines together that really need to be 
separate.  Have you tested it?

As for line number counting in the compiled PHP files, I don't see how 
that can or should correspond to line numbers in the template source. If 
we can figure out a way to make the line numbers correspond _and_ make 
template output identical to source, then I don't see a problem with it. 
But I doubt that is the case.

Monte

Dmitry Koteroff wrote:

>B> that html is not the only output target). I have no faith that
>B> these  patches  will be transparent for all users. The risk of
>B> breaking  someone's  output  to  support  this  proposal seems
>B> unwarranted   to  me,  particularly  since  its  aim  is  more
>B> pendantic than productive IMHO.
>What  risk?  What are you talking about? Output is not changed at
>all  - I only offer to remove unneeded \n's in PHP code (they are
>not echoed) and after ?> (they are ignored too by PHP istself) to
>synchronize   compiled   template   code   with  source  template
>line-by-line. No more, no less.
>
>I  do  not understand you at all. Maybe my english is too bad and
>explainations are too short (my original language is Russian)?
>
>You say below that compiled template code must be human-readable.
>I agree with it, but, first, it's too late to think about it (see
>real  compiled template - they are practically too complex), and,
>second,  additional  \n's do not improve readability of code more
>than 10-15%, but they trash the debug process great.
>
>I'd  like  to  head Smarty developers words too - Monte Ohrt, for
>example.
>
>P.S.
>Theorem:  "If  any  compiler  does not include "\n" string in its
>code  (or  chr(0x10)  etc.),  it  cannot  affect  to  line number
>synchronization at all." (-;
>
>  
>

-- 
Smarty Development Mailing List (http://smarty.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.