Elxis CMS Forum
Support => Elxis 4.x/5.x DEV => Topic started by: datahell on May 13, 2019, 22:03:37
-
This is how you can create modal windows in Elxis 5.x The contents of the window can be anything, a form, a text, or you can load them dynamically via AJAX.
Initialize HTML helper:
$htmlHelper = $elxis->obj('html');
Start modal window:
echo $htmlHelper->startModalWindow('Title here', 'uniquesuffix');
Put anything inside the modal window:
echo '<p>Anything!</p>';
Close the modal window:
echo $htmlHelper->endModalWindow();
That's it!
But how we invoke/display the modal window?
It's very simple. We do so with the elx5ModalOpen javascript function with the modal's suffix as input parameter. Example:
<a href="javascript:void(null);" onclick="elx5ModalOpen('uniquesuffix');">Open modal</a>