Pass value from a block to the footer.
Permalink
Is there a way to pass a value from a block and make it available to the page footer ? I have a block that gets some data from a 3rd party API. Some of that data needs to be available to the page footer when it renders. Can I temporarily store this data in the current page or view somewhere ? And no, it's not just a matter of calling setFooter or setHeader from the block for this particular situation.
Thanks,
Warren
Thanks,
Warren
Why not store it in a hidden input html tag in the block, and retrieve it in the footer ?
$this->set() from the block controller might even work, but I'm not sure about the scope.
$this->set() from the block controller might even work, but I'm not sure about the scope.
Excuse my ignorance, but how do I get the values back out of the hidden fields once I am in the footer, jQuery ?
yes, if you take that route.
Probably need to put it inside a document ready, something like:
Probably need to put it inside a document ready, something like:
$(document).ready(function () { var myval = $('#myselector').val(); })
ah, sorry
I said footer, but meant block/view.php
no need to change any theme files then.
add a bit of javascript to the view, to retrieve the value from the hidden input, and insert it wherever you want.
----
If you do change your theme...then I would just handle it within the theme
I said footer, but meant block/view.php
no need to change any theme files then.
add a bit of javascript to the view, to retrieve the value from the hidden input, and insert it wherever you want.
----
If you do change your theme...then I would just handle it within the theme
Thanks,
Warren