https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31786

David Cook <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |[email protected]

--- Comment #4 from David Cook <[email protected]> ---
(In reply to Marcel de Rooy from comment #3)
> (In reply to Jonathan Druart from comment #2)
> > What is the context? Why don't you use CGI->param? :)
> 
> See description too. If earlier code like C4/Auth already pushed info into
> the template object, it would be nice to read it back later (instead of
> requerying etc.). Yes, we can access {VARS} but that looks like a bad
> practice.
> In such a case CGI::param might not be in the picture.

In frameworks like Catalyst and Mojolicious, the controller has a "stash"
method which provides getting/setting of values to pass to the template. I've
certainly used it for both getting and setting in both frameworks.

Catalyst:
$c->stash->{foo} = $bar;
$c->stash( { moose => 'majestic', qux => 0 } );
$c->stash( bar => 1, gorch => 2 ); # equivalent to passing a hashref

Mojolicious:
my $name = $c->stash('name');
$c->stash(text => "Hello $name");

https://metacpan.org/pod/Catalyst#$c-%3Estash
https://docs.mojolicious.org/Mojolicious/Guides/Tutorial#Stash-and-templates
https://mojolicious.io/blog/2017/12/02/day-2-the-stash/

So returning a value from $template->param() does sound reasonable.

However... I thought that we were moving away from $template->param() and to
$template->{VARS} in general. (Although I don't see a Coding Guideline that
says that.)

-- 
You are receiving this mail because:
You are watching all bug changes.
You are the assignee for the bug.
_______________________________________________
Koha-bugs mailing list
[email protected]
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to