<commit_before><?php

# Single whisky view.
$app->get('/whiskies/', function ($id) use ($app) {
	$c['config'] = require dirname(__FILE__) . '../config/config.php';

	$config = $c['config'];

	$query_factory = new QueryFactory('mysql');
	$select = $query_factory->newSelect();

	$select->cols( array('id','name','distiller_name') )->from('whiskies')->where( "id = $id");

	// a PDO connection
	try {
	    $pdo = new \PDO($config['db.dsn'], $config['db.username'], $config['db.password']);

		$sth = $pdo->prepare($select->__toString());
		// bind the values and execute
		$sth->execute($select->getBindValues());
		// get the results back as an associative array
		$result = $sth->fetch(\PDO::FETCH_ASSOC);
	} catch (\Exception $e) {
	    echo 'Caught exception: ',  $e->getMessage(), "\n";
	}

    $app->render('home.php', array(
		'title' => 'Hello Slim.',
		'body'  => ['id' => $result['id'], 'name' => $result['name'], 'distillery' => $result['distiller_name'] ]
	));
});<commit_msg>update to plates templating<commit_after><?php

namespace tw2113\Whichsky;

use \Slim\Slim as Slim;
use \Slim\Logger as Logger;
use \Aura\SqlQuery\QueryFactory;
use \League\Plates\Engine as Plates;

$app->get('/whiskies/', function() use ($app) {

    $templates = new Plates('./templates');

    // Render a template
    echo $templates->render('whiskies');
});
{'fraction_non_alphanumeric': 0.22106824925816024, 'fraction_numerical': 0.002967359050445104, 'mean_word_length': 4.33201581027668, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 22, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3471067', 'n_tokens_mistral': 485, 'n_tokens_neox': 467, 'n_words': 104}