joomla:modalbox
Dies ist eine alte Version des Dokuments!
Inhaltsverzeichnis
Joomla - Modalbox
Wie stelle ich es an, dass gewisse Inhalte einer Komponente in einer Modalbox angezeigt werden?
Inhalt der Modalbox
Der Inhalt der Modalbox kann zum Beispiel mit einer eigenen Komponenten-View gefüllt werden.
Dazu werden folgende Dateien benötigt:
views/testview/view.raw.php
views/testview/tmpl/modalbox.php
- view.raw.php
<?php // No direct access defined('_JEXEC') or die; use \Joomla\CMS\Factory; /** * View class for modals */ class ComponentViewTestview extends \Joomla\CMS\MVC\View\HtmlView { /** * Display the view * * @param string $tpl Template name * @return void * @throws Exception */ public function display($tpl = null) { $app = Factory::getApplication(); $this->state = $this->get('State'); $this->params = $app->getParams('com_component'); // Check for errors. if (count($errors = $this->get('Errors'))) { throw new Exception(implode("\n", $errors)); } $this->_prepareDocument(); parent::display($tpl); } }
- modalbox.php
<?php // No direct access defined('_JEXEC') or die; //URL: index.php?option=com_component&view=testview&format=raw&layout=modalbox ?> <p>Inhalt der Modalbox</p>
Aufrufen der Modalbox
Mootols: Modalbox
- default.php
<?php use \Joomla\CMS\HTML\HTMLHelper; use \Joomla\CMS\Router\Route; HTMLHelper::_('behavior.modal'); . . . <a id ="modalbox1" href="<?php echo Route::_('index.php?option=com_component&view=testview&format=raw&layout=modalbox'); ?>" class="modal">Open Modalbox</a>
Bootstrap: Modalbox
- default.php
<?php use \Joomla\CMS\HTML\HTMLHelper; use \Joomla\CMS\Router\Route; . . . <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#bootstrapModalbox"> Bootstrap: Modalbox </button> <!-- Modal-Box --> <div class="modal hide fade jviewport-width80 in" id="bootstrapModalbox" tabindex="-1" aria-labelledby="bootstrapModalboxTitle" aria-hidden="true"> <div class="modal-header"> <button type="button" class="close novalidate" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true">×</span> </button> <h3 id="bootstrapModalboxTitle">Modalbox title</h3> </div> <div class="modal-body"> <iframe class="iframe" src="<?php echo Route::_('index.php?option=com_attlist&view=meldungform&format=raw&layout=modal_success'); ?>" name="iframe name"></iframe> </div> <div class="modal-footer"> <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button> <button type="button" class="btn btn-primary">Save changes</button> </div> </div>
joomla/modalbox.1596186491.txt.gz · Zuletzt geändert: 31/07/2020 11:08 von Manuel