Skip to content
Matthew McNaney edited this page Aug 4, 2015 · 4 revisions

PHP

$id = 'my-modal';
$content = 'This is the modal body';
$title = 'This is the title of the modal';
$modal = new \Modal($id, $content, $title);

// wider modal
// $modal->sizeLarge();

// slimmer modal
// $modal->sizeSmall();

$modal->addButton('<button id="do-something">Do something</button>');
$template = \Template(array('modal'=>$modal), 'template.html');
echo $template;

template.html

<button id="open-modal">Open Modal</button>
<?=$modal?>

Javascript

$(window).load(function() {
    $('#open-modal').click(function(){
        $('#my-modal').modal('show');
    });
});
Clone this wiki locally