Hi Adrian,
Thank you very much for your reply and hint.
I tried to define some variables in %STASH within a Plugin hooking to init.
I cannot see how to make them available in scripts and templates.
I tried a Plugin hook:
my (@args) = @_;
$STASH{test} = "I was here!";
return @args;
}
... and it did not work. I thought a problem might be this part of sub init { within Links.pm
(%STASH, $GLOBALS, $LANGUAGE, $USER) = ();
}I changed it to:
(%STASH, $GLOBALS, $LANGUAGE, $USER) = ();
$STASH{anothertest} = "...and here";
}
The code did not make anything show up neither in a perl script nor in a template (I used Data Dumper for %STASH which is empty, $STASH{test), $STASH{anothertest} and <%STASH.test%>).
It would be great to get another hint.
I thought of using $IN as well but I do not like this one either but maybe there is no problem:
my (@args) = @_;
$IN->{mystash} = {};
$IN->{mystash}->{test} = "... and here as well";
return @args;
}I guess the code is just dynamically and cannot be overwritten by params. So it might be better than using $CFG but %STASH seems to be more reasonable.
Regards
n||i||k||o
Thank you very much for your reply and hint.
I tried to define some variables in %STASH within a Plugin hooking to init.
I cannot see how to make them available in scripts and templates.
I tried a Plugin hook:
Code:
sub init { my (@args) = @_;
$STASH{test} = "I was here!";
return @args;
}
... and it did not work. I thought a problem might be this part of sub init { within Links.pm
Code:
$PLG->dispatch('init', sub {}); (%STASH, $GLOBALS, $LANGUAGE, $USER) = ();
}
Code:
$PLG->dispatch('init', sub {}); (%STASH, $GLOBALS, $LANGUAGE, $USER) = ();
$STASH{anothertest} = "...and here";
}
The code did not make anything show up neither in a perl script nor in a template (I used Data Dumper for %STASH which is empty, $STASH{test), $STASH{anothertest} and <%STASH.test%>).
It would be great to get another hint.
I thought of using $IN as well but I do not like this one either but maybe there is no problem:
Code:
sub init { my (@args) = @_;
$IN->{mystash} = {};
$IN->{mystash}->{test} = "... and here as well";
return @args;
}
Regards
n||i||k||o