Don’t use Tintype, use Cactus. I stopped maintaining Tintype the moment I found out about Cactus. It’s exactly what I wanted Tintype to be—Django templates and handy shortcuts that compile to flat HTML.
I built Tintype sometime in early 2010 to scratch an itch (hey there jQuery 1.4.2). I used for a couple of years until I cooked up a nasty little Python script that used Jinja to basically do the exact same thing, but without semicolons.
The (mostly) original README:
Tintype is a simple HTML prototyping engine written in PHP. It uses a PHP implementation of the Django template engine called Twig.
Here’s how this all went down. I used Django for a little project, and instantly fell in nerd-love with the template engine. I wanted to use it on everything, but that just isn’t practical. Tintype allows you to use the Django template engine and all its conveniences for prototyping, but once you’re done, you can flatten the Django template file out to a normal HTML file. Neat-o!
PHP5-ish is required (obviously).
- Dump the contents of this repository in a web-accessible directory.
- Copy the contents of
/sites/example/
into a new directory in/sites/
. - Put templates (HTML, XML, JSON) in the templates directory, and media (images, CSS, JS) in the media directory. Media is accessible via the MEDIA_URL variable (example:
{{ MEDIA_URL }}style.css
). - Visit
http://prototype-url/site-folder/
, where site-folder refers to the new folder you created in step 2. This page is the project index, and if you have templates in the templates directory, they’ll be displayed there. - There is no step five!
- How I use Tintype: I use VirtualHostX for local development (and you should too!) and I use a virtual host called
prototypes
for all my HTML prototyping stuff. - If you don’t want a file to show up in the project view, prefix the filename with an
_underscore
, and it won’t show. This works nicely if you have several base templates you don’t want visible in the project index, or old versions of templates that you don’t want to delete. - Click Recompile Templates to, well, recompile all your Django templates to flat HTML. The compiled templates will be in
templates-compiled
in the site directory. That way, you can zip and share the templates easily. - Set variables in
data.yml
. You can create an array and iterate through it using a Djangofor
loop in any template.
Don’t you fret!! Put this in your server
block:
location / {
root /path/to/site/;
index index.html index.php;
if ($request_filename ~ /) {
rewrite ^/(.*)$ /index.php/$1 last;
}
}
Can’t help you there. Google that bidness.
I’ll get some sort of /index.php/
hack in there for you poor mod_rewrite
-less fools.