I recently rebuilt a website about Car Driving School with web2py and
Blueprint. The url of the website is as follow:

http://www.haijia.org/

I thought the default layout of web2py web development framework is a
little too complicated and less flexible, and the compatible problem
of IE 6 also annoyed me a lot. So I picked up the most popular
Blueprint CSS framework instead.

I wrote the layout_haijia.html to replace layout.html. The skeleton is
as follow, which is SEO optimized:

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>{{=response.title}} | {{=response.keywords}}</title>
<link rel="shortcut icon" type="image/x-icon" href="{{=URL('static/
images', 'favicon.ico')}}" />
<meta name="Description" content="{{=response.description}}" />
<meta name="Keywords" content="{{=response.keywords}}" />
<link rel="stylesheet" type="text/css" href="{{=URL('static/css',
'screen.css')}}" media="screen, projection" />
<link rel="stylesheet" type="text/css" href="{{=URL('static/css',
'haijia.css')}}" media="screen, projection" />
<!--[if lt IE 8]><link rel="stylesheet" type="text/css"
href="{{=URL('static/css', 'ie.css')}}" media="screen, projection" /><!
[endif]-->
<link rel="stylesheet" type="text/css" href="{{=URL('static/css',
'print.css')}}" media="print" />
{{block head}}{{end}}
<!-- Google Analytics -->
    <!-- The Google Analytics Javascript code. -->
<!-- End Google Analytics -->
</head>
<body>
{{include}}
</body>
</html>

Then the new index.html can be wrote this way:

{{extend 'layout_haijia.html'}}
<div id="home" class="container">
    <div class="header span-24">
        {{include request.controller+'/header.html'}}
    </div><!-- End .header -->

    <div class="content span-18">
        The main content of the page.
    </div><!-- End .content -->
    <div class="right_sidebar span-6 last">
        The right sidebar of the page.
    </div><!-- End .right_sidebar -->

    <div class="footer span-24">
        {{include request.controller+'/footer.html'}}
    </div><!-- End .footer -->
</div><!-- End #home -->
{{block head}}
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/
libs/jquery/1.6.2/jquery.min.js"></script>
{{end}}

The final things we have to do are writing static/css/haijia.css,
default/header.html, and default/footer.html.

The whole procedure is productive and painless. I recommend all of you
to try it -- the gold combination of web2py and Blueprint.

Reply via email to