Skip to content

Instantly share code, notes, and snippets.

@chanakasan
Created November 7, 2013 12:17
Show Gist options
  • Save chanakasan/7353738 to your computer and use it in GitHub Desktop.
Save chanakasan/7353738 to your computer and use it in GitHub Desktop.
Symfony2 custom error page, (put in app\Resources\TwigBundle\views\Exception)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Page not found!</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
<!-- Le styles -->
{% block stylesheets %}
<link href="/assets/bootstrap/css/bootstrap.css" rel="stylesheet">
<link href="/assets/bootstrap/css/bootstrap-responsive.css" rel="stylesheet">
<style>
body {
background: #f0f0f0;
/*background: rgb(24, 28, 33);*/
}
.bubble
{
position: relative;
width: 550px;
height: 210px;
background: #FFFFFF;
border: #7E7D7F solid 7px;
-webkit-border-radius: 55px;
-moz-border-radius: 55px;
border-radius: 55px;
}
.bubble:after
{
content: "";
position: absolute;
bottom: -45px;
left: 57px;
border-style: solid;
border-width: 45px 23px 0;
border-color: #FFFFFF transparent;
display: block;
width: 0;
z-index: 1;
}
.bubble:before
{
content: "";
position: absolute;
top: 210px;
left: 51px;
border-style: solid;
border-width: 51px 29px 0;
border-color: #7E7D7F transparent;
display: block;
width: 0;
z-index: 0;
}
</style>
<!-- HTML5 shim, for IE6-8 support of HTML5 elements -->
<!--[if lt IE 9]>
<script src="/assets/bootstrap/js/html5shiv.js"></script>
<![endif]-->
{% endblock %}
<!-- Fav and touch icons -->
<link rel="shortcut icon" href="/app/img/favicon-app.ico">
</head>
<body>
<div class="container">
<!-- if javascript is turned off -->
{% block noscript %}
{{ include('no-script.html') }}
{% endblock %}
<div class="row"><!-- Flash notification messages -->
<div class="span10 offset1">
{{ include('show-flash-msgs.html.twig') }}
</div>
</div>
<!-- page contents go inside below block -->
<div class="row">
<div class="span11 offset1">
<br/><br/>
<div class="bubble">
<div class="content" style="margin-left: 2em">
<br/>
<h2>{{ status_code }} {{ status_text }}</h2>
{% if status_code == 403 %}
<h3>Sorry, you don't have sufficient privileges to view this page.</h3>
{% else %}
<h3>Sorry, the page you requested does not exist.</h3>
{% endif %}
</div>
</div>
</div>
</div>
</div>
<!-- /container -->
{% block javascripts %}
<script src="/assets/jquery/jquery-1.9.1.min.js"></script>
<script src="/assets/bootstrap/js/bootstrap.min.js"></script>
{% endblock %}
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment