It seems the renderWith() in my init() is being overidden by the default tempalte for the page type. WHen I check ?showtempalte=1 that shows the correct template, but the one rendered is incorrect.
class Artwork_Controller extends Page_Controller {
private static $allowed_actions = array (
);
public function init() {
parent::init();
$image = $this->OrderedImages()->first();
if($image && $ratio = $image->getRatio()) {
if($ratio > 1.2 ) {
$this->renderWith("ArtworkWide");
} elseif ($ratio < 0.8) {
$this->renderWith("ArtworkNarrow");
} else {
$this->renderWith("Artwork");
}
}
}
}