Nette Framework 2.2.0 released!

Notice: This thread is very old.
David Grudl
Nette Core | 8082
+
+4
-

I'd like to announce the Nette Framework 2.2.0, the biggest revolution in its history.

Nette has been split into small projects Application, Bootstrap, Caching, ComponentModel, Nette Database, DI, Finder, Forms, Http, Latte, Mail, Neon, PhpGenerator, Reflection, RobotLoader, SafeStream, Security, Tokenizer, Tracy and Nette Utils.

It also brings complete new Latte API for standalone usage:

$latte = new Latte\Engine;
$latte->setTempDirectory('/path/to/cache');
$latte->addFilter('money', function($val) { return ...; }); // formerly registerHelper()

$latte->onCompile[] = function($latte) {
    $latte->addMacro(...); // when you want add some own macros, see http://goo.gl/d5A1u2
};

$latte->render('template.latte', $parameters);
// or $html = $latte->renderToString('template.latte', $parameters);

Also Nette\Diagnostics was renamed to nice and short Tracy.

You can, as usual, download complete package or install it via Composer.

chemix
Nette Core | 1294
+
+1
-

I need to say “perfect work”

Honza Kuchař
Member | 1662
+
0
-

Amazing work!

tpr
Member | 55
+
0
-

Currently I'm experimenting with standalone Latte in a ProcessWire project and so far so good.

I would like to ask is there any way to set the default Latte template (globally), or do I need to use "{layout '@layout.latte'}" in every latte file?

janpecha
Backer | 75
+
+2
-

@tpr Only way now is using of “fake” presenter:

<?php
class FakePresenter extends Nette\Application\UI\Presenter
{
	public function findLayoutTemplateFile()
	{
		return "/path/to/layout";
	}
}

$presenter = new FakePresenter;
$latte = new Latte\Engine;
$latte->render(..., array(
	'_control' => $presenter,
));
?>

You can use own UI\Presenter, not only from nette/application package:

<?php
namespace Nette\Application\UI;

if (!class_exists('Nette\Application\UI\Presenter')) {
	class Presenter
	{
	}
}
?>
tpr
Member | 55
+
0
-

Great, works fine, thanks!