Re: [Formsess-devel] access formsess from within the template ($smarty.formsess)
Status: Beta
Brought to you by:
mrkatana
|
From: Katana <ka...@ka...> - 2004-04-24 11:37:58
|
> regarding the proposal for a <fs:ifErrors> tag.
>
> Handling of errormessages in the template is rather inflexible atm.
> There's no possibility to loop all messages for example.
Yeah, I had that in mind in the beggining, but it has never been
implemented since I didn't stumble upon a proper syntax yet...
> Hooking in to smarty somehow and having a $smarty.formsess variable with
> at least two keys 'values' and 'errors' would be great.
>
> Then you could simply do
> {foreach from=$smarty.formsess.errors item="error"}
> ..
> {/foreachelse}
> Form doesn't have any errors
> {/foreach}
Hmmm of course that's a possibility, but I don't think we should mix
formsess syntax and smarty syntax, what do you think ? Of course it
would be totally useless to rewrite loops code and all that stuff for
formsess itself but I'm not sure it is the way to go... I have to think
about it.
> (I just don't know how that would work when you want to use that var
> before the form tag is openend and you don't create a formsess object in
> the php code, because that object would only be createt with the opening
> of the form tag)
Theorically, if you do something like $smarty.formsess.formname.errors
(or any similar syntax), it can be done, since formsess uses a kind of
singleton pattern. Not properly implemented yet, though _ has to be done
for 2.0.0 _ but it should work. We would have to write a wrapper with
our own syntax though... since calling that from outside a form would
require to create a formsess instance if it was not created before, the
way it's done in the fs:form tag.
Katana
|