Need opinions on @section/var

From: Date: Thu, 16 Mar 2000 15:21:16 +0000
Subject: Need opinions on @section/var
Groups: php.template 
Request: Send a blank email to php-template+get-318@lists.php.net to get a copy of this message
I need help and opinions on how @section/var (and #section/var) syntax should function. As a reminder, it refers to the value of a variable as it exists in another section. Now, the problem is this. It is not possible during parsing time to resolve whether the section name specified by the construct exists. The validation can be done only after the whole template is parsed. However, several issues come into play. 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. 2) What if there is more than one section with that name? Which one should it use? The first one? 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? 4) Another option is when @section/var is encountered at parsing time it would check only those sections that have been defined so far to see whether the name is there. This does not allow forward references, but, like I said, it might not be useful. Another issue I wanted to mention is that #TOTAL is going to be valid only inside the section and after it. Example: { section sec1 } Category: $category { section sec2 } Headline: $headline { /section } { /section } The #TOTAL for sec2 is going to be undefined the first time Category is printed. It will be calculated only when we enter sec2 and also after it, the second time Category is printed. Basically, #TOTAL is calculated each time you enter the section and it's persistent afterwards until the next time. I hope it's not an inconvenience. -Andrei * I wish life had an UNDO function. *

« previous php.template (#318) next »