refreshPluginSlot()
function module_class_name.refreshPluginSlot(slotNameOrContainedElement, requests, scrollToTopOfSlot, fadeOutAndIn)
Triggers a refresh for a Plugin in a Slot.
Anywhere in your JavaScript code in the front-end. From Zenario 7.0.0 onwards.
Triggers the CMS to reload a Plugin in a Slot via AJAX. Usually this would be your Plugin in its current Slot.
Note that there are two utility functions available in PHP called refreshPluginSlotAnchor()
and refreshPluginSlotJS()
which automatically generate theHTML and JavaScript code that you need to do this. When creating links and buttons for a Framework you should use these two functions to generate the code needed instead.
slotNameOrContainedElement
The name of the Slot on the current page to reload. You should write this in using the $slotName
environment variable.
Alternately, you can pass in an element from the Slot, and the CMS will look up the name of the Slot from that.
requests
Any GET requests you wish the Plugin to see as it is reloaded. Should be in the format:
request1=value&request2=value
Note that you can't use POST. If you need POST then you should use a form instead; see the openForm
utility function for details.
No return value.
plugin_class_name.refreshPluginSlot('Main_Slot_1', 'request=value');
Reload the Plugin in the "Main_Slot_1" Slot, with a GET request. Or alternately you can use:
<a onclick="plugin_class_name.refreshPluginSlot(this, 'request=value');">
from a link in the slot to do the same thing.
(Note that this is probably a bad example, as it does not degenerate gracefully for visitors whose JavaScript is turned off. If you use it you should really add a href link for them, and add return false;
to the onclick
above. )