Canvas/JavaScript scrolling tile-map demo

November 12th, 2009 Posted in Programming | No Comments »

Here’s something I did for fun in May as a proof of concept. It uses JavaScript and the canvas tag to render a Super Mario Brothers style tile-map with background. Try it in Firefox 3.5+, Safari 4+, or Chrome/Chromium.

or arrow keys to move view
small | medium | large

Expression Engine, Redux

November 5th, 2009 Posted in Uncategorized | No Comments »

Not too long after my recent unease when trying Expression Engine, I got called on to code a redesign of an Expression Engine site for a client.

The original site was very well-coded; good markup, good uses of CSS. While I still don’t find EE to be much of a user’s CMS (and nowhere near as general-purpose as Drupal), making CSS and HTML changes was very straightforward. (I used FTP to upload the new images and to update one CSS file which, oddly, wasn’t controlled by EE…)

I thought of EE as an HTML/CSS management system before; I can see it really is. It’s a good way to be able to edit all the HTML that goes into each section of your pages without having to write PHP. So it’s probably great for designers used to making HTML-based sites who hate having duplicated HTML in every file.

There is a trade-off, though. You’ve got to use EE’s templating syntax to do any logic necessary in your HTML partials. It might be worth learning, though, for those wanting to avoid PHP at all costs.

Drupal Pitfall: @import-ing CSS

November 4th, 2009 Posted in drupal | No Comments »

Pitfall:

/* local.css */
@import "menu-styles.css"
@import "foobarbaz.css"

This pitfall causes style breakage when enabling Drupal’s CSS aggregation/caching.

Symptom

Some parts of the page (e.g., the primary links menu) look completely different after enabling caching.

Cause

Drupal’s CSS caching aggregates all your theme’s and your modules’ CSS files into one file (to minimize HTTP requests). But it doesn’t look for @import statements in CSS when doing so.

Solution

Declare all your CSS files in your theme’s .info file:

# mytheme.info
stylesheets[all][] = menu-styles.css
stylesheets[all][] = foobarbaz.css

and remove your CSS @import statements. (And as always, rebuild the theme registry for the changes to take effect.)

Drupal Pitfalls

November 4th, 2009 Posted in drupal | No Comments »

Forgetting to put

<?php print $closure; ?>

in your theme’s page.tpl.php.

Forgetting the closure prevents modules like Google Analytics from being able to put JavaScript at the end of the page body. Without that JavaScript, not much analytics…izing gets done.

This is a fairly common mistake, in my experience as a Drupal maintenance programmer.