Re: [PHP Template] Need opinions on @section/var

[email protected] (Andrei Zmievski) Fri, 17 Mar 2000 10:29:16 -0600
Newsgroups php.template
Message-ID <[email protected]>
On Fri, 17 Mar 2000, Monte Ohrt wrote:
> > 1) What if there are no sections with that name? Obviously, it should
> > output some sort of error, but I think it should not abandon execution
> > and should instead treat @section/var simply as @var.
> 
> I'm not sure I would give it @var, maybe leave the value unset.

You can't leave it unset if there have been values assigned to it by the
script. What we can do is completely ignore it as if it's never been
mentioned, but I'm not sure if it's a good design.

> > 2) What if there is more than one section with that name? Which one
> > should it use? The first one?
> 
> Maybe the most recently executed section?

This needs to be done at parsing time, not during execution. The most
recently defined section might be possible.

> > 
> > 3) Would it ever be useful for this construct to have forward
> > references, i.e. you use @sec2/var and 'sec2' is 40 lines down the page?
> 
> I can't think of many good uses of this. Would this have a parsing
> overhead?

Yes, it would, somewhat.

I think we should disallow forward references and only use the latest
defined section if there are multiple sections with that name. It's
always easier to go from more restrictive to less restrictive, if we
want to modify this in the future.

-Andrei

Computer, if you don't open that exit hatch this moment I shall zap straight
off to your major data banks and reprogram you with a very large axe.
-- Douglas Adams / The Hitchhiker's Guide to the Galaxy