Skip to content

Instantly share code, notes, and snippets.

@fotan
Last active October 7, 2016 15:42
Show Gist options
  • Save fotan/7e7bce8503dc47acbcec53a94a8c7705 to your computer and use it in GitHub Desktop.
Save fotan/7e7bce8503dc47acbcec53a94a8c7705 to your computer and use it in GitHub Desktop.
BS3 - Dynamic Alerts
// Set $alert_type and $message somewhere else
<?php if(isset($message)) { ?>
<br />
<div class="row">
<?php
// Add ability to display different types of alerts.
// For backwards compatibility, if $alert-type isn't set, set it to alert-info.
// Options are: success = green
// info = blue
// warning = yellow
// danger = red
if(!$alert_type) {
$alert_type = "info";
}
?>
<div class="alert alert-<?php echo $alert_type; ?> alert-dismissible" role="alert">
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<?php echo $message; unset($message); ?>
</div>
</div>
<?php } ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment