Static can be more
Jozef Kutej
1. theory
1.1. static pages?
1.2. dynamic pages?
2. examples + practical solutions
2.1. http://ba.pm.org/
2.2. Makefile + inotify
2.3. Template::Toolkit
2.4. xml+xslt => .tt2 & .rdf
2.5. SVN for RC and deployment
2.6. store + planet + testing + minification + ...
I hope that there will be something new for everyone and you'll
enjoy it, or ...
let's start
Dynamic pages
- dynamic => interactive experience
- react to context/conditions/input
- server side
- or client side
Server side static pages
- pre-generated interactive experience ;-)
- these are the target of my talk
- (btw is this talk html static or dynamic?)
Static Pages/Content
advantages
- fast "processing" by web server
- can be served by any web server (or even file://)
- nginx - 10000 inactive HTTP keep-alive connections take about 2.5M memory
- 100k requests for a .png (313kB) from 1000 clients
in 12.5s (8034.86 [#/sec])
- it's cheap to serve users with static pages
- can be served through a Content delivery network (CDN)
Static pages
disadvantages
- there has to be some tool to generate them, otherwise it will be a nightmare to try to keep a consistent look and manage updates
- there is no "well known tool"
- there is no "well known how-to"
server side Scripting/Programming
advantages
- that's the only way to get the credit card number
- lots of books/tutorials/documentation
- my friend/coworker/everyone does it
server side Scripting/Programming
disadvantages
- costs CPU
- costs RAM
- mostly requires a specific web server (Apache HTTPD, IIS, Tomcat)
- ASP, PHP, JSP, SSI, CGI, ...
Laziness
<?
Include "./_conf.php";
Include "./_head.php";
?>
<h1>Welcome to my page.</h1>
<p>For an idea that does not at first seem insane,
there is no hope.</p>
<?
Include "./_tail.php";
?>
Compromise

-KOMPROMIS (2005 LP)-
the practical part
BA.pm.org more features
- planet
- xhtml validation tests
- internal links check
- sitemap.xml
- can be hosted on anything, even file://
(with the exception of send-feedback.cgi, planet, store)
- auto deployment from SVN with commit diff emails
- 2 stage development (dev+prod)
(extensible to 3 stage if it's ever needed)
it's better to see once
then to hear 100 times
for the curious

TMB score

72 out of 100
HOW?
Makefile + inotify
Template::Toolkit
- http://search.cpan.org/perldoc?Template
- This templating module allows special marks to be added into the text,
which are then processed. The default ones are
[% %],
but can be redefined.
- Standard usage of Template Toolkit is for MVC frameworks, where it can be
used as a View component to generate XML, plain text, ... and of course
HTML.
ttree
- TT has a `ttree` command
- this is used to convert a tree of templates into HTML (or some other output format)
- this is how BA.pm.org is generated
_cfg.tt2,
_wrapper.tt2,
_header.tt2,
_footer.tt2,
redirect.tt2
events.xml + events-to-(html|rdf).xslt
- events.xml + events-to-html.xslt => events.tt2
- events.xml + events-to-rdf.xslt => news.rdf
who.xml + who-to-(html|js).xslt
- who.xml + who-to-html.xslt => who.tt2
- who.xml + who-to-js.xslt => 06_mongers.js
i18n
- .tt || .tt-en
- [% IF lang %]
- feedback form with Locale::Maketext (+HTML::FormFu)
(.yaml -> .tt2)
- JavaScript i18n
send-feedback.cgi
- checks input
- sends email to hiveminder.com
- redirects to /cgi/email-(ok|fail).html
- anti-spammer protection
nginx.conf
SVN notify + deploy hooks
- `meld html/`
- `svn commit`
- SVN::Notify
- `svk up`
the rest
- `vxml -v --ignore ...`
- java -jar script/yuicompressor-2.4.2.jar
- sitemap.xml
- Amazon store (iframe)
- `planet`
That's it
Thank you!
- any comments later?
- you can use feedback form on ba.pm.org anytime!
