PHPackages                             drarok/kotal - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Templating &amp; Views](/categories/templating)
4. /
5. drarok/kotal

ActiveKohana-module[Templating &amp; Views](/categories/templating)

drarok/kotal
============

PHPTAL Templates for Kohana

121PHP

Since Nov 8Pushed 12y ago1 watchersCompare

[ Source](https://github.com/Drarok/KOtal)[ Packagist](https://packagist.org/packages/drarok/kotal)[ RSS](/packages/drarok-kotal/feed)WikiDiscussions develop Synced yesterday

READMEChangelogDependenciesVersions (1)Used By (0)

KOtal
=====

[](#kotal)

KOtal is a module for Kohana 3.3 that implements PHPTAL as a view processor.

PHPTAL is a PHP implementation of Zope Page Templates (ZPT). To be short, PHPTAL is a XML/XHTML template library for PHP.

Originally created by [Hanson Wong](https://github.com/Dismounted/KOtal), this fork adds:

- Support for Kohana 3.3.
- Support for installation via Composer.
- Default to xhtml file extension.

Installation via Composer
-------------------------

[](#installation-via-composer)

composer.json:

```
	{
	    "require": {
	        "drarok/kotal": "dev-develop"
	    }
	}
```

bootstrap.php:

```
	Kohana::modules(array(
		'kotal' => MODPATH . 'kotal',
	));
```

Usage
-----

[](#usage)

Create views in the normal application/views directory, but with an xhtml extension, and adhere to TAL syntax and rules.

KOtal also routes i18n requests into native Kohana methods.

There are a few 'advanced' options, and they are shown in the examples below.

Example
-------

[](#example)

Firstly, create a new view file called taltest.xhtml and place it under views/.

```

	Sample Title - Not Output
	Example Name - Not Output

```

Then in your controller, add the following code to generate and display your view.

```
$view = View::factory('taltest');
$people = array(
	'Alan',
	'Bob',
	'Jane',
	'Maria'
);
$view->title = 'People';
$view->people = $people;

$this->response->body($view);

```

Accessing this action, you should see:

```
People

Alan
Bob
Jane
Maria

```

Now say we didn't want to store TAL views with an 'xhtml' extension. We would like to use 'html' instead. Simply change the extension on your views and change the option in config/kotal.php.

```
'ext' => 'html',

```

This is a global setting and will affect all views that are generated through KOtal.

Next, we would like to change how KOtal outputs out documents. Easy. There are two relevant methods.

```
$view->set_output_mode(PHPTAL::XHTML)
     ->set_encoding('utf-8');

```

These are the default settings, see the PHPTAL documentation for available options.

Say if you were in the middle of changing to TAL, and some views had yet been converted. No worries, we can just disable TAL processing on a per-view basis.

```
$view->use_tal(FALSE);

```

Lastly, other features that appear in Kohana's default handler should work in KOtal, such as method chaining and setting the view file path just before rendering. Thus, our final example code could be:

```
$view = View::factory()
	->set_output_mode(PHPTAL::XHTML)
	->set_encoding('utf-8')
	->set(array(
		'people' => array(
			'Alan',
			'Bob',
			'Jane',
			'Maria'
		),
		'title' => 'People'
	))
	->set_filename('taltest');
$this->response->body($view);

```

Caveats
-------

[](#caveats)

As KOtal overrides the default Kohana view handler, modules that use "normal" views will fail initially. You can fix this by using the controller exclude list inside config/kotal.php. Simply drop in the controller's name (as defined inside routes).

```
'exclude' => array(
	'codebench',
	'unittest',
	'userguide',
),

```

Alternatively, you can globally disable KOtal in config/kotal.php.

```
'enabled' => FALSE,

```

Then, as you convert each view, you can switch KOtal on for that one view.

```
$view->use_tal(TRUE);

```

Once all of your views have been upgraded to use PHPTAL, you can switch KOtal on globally and remove all the use\_tal(TRUE) calls.

Modules that ship with Kohana 3.3 by default will already be covered in the default KOtal configuration.

Other
-----

[](#other)

KOtal is licensed under the New BSD License. Credits to zombor's KOstache for the initial inspiration and naming idea.

PHPTAL is licensed under the terms of the GNU Lesser General Public License.

For more specific documentation on creating TAL views, see the [PHPTAL Website](http://phptal.org/).

###  Health Score

21

—

LowBetter than 18% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 72% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/c2fecfeadca598be917b367e724355b2ca1bef3611ca1bc4ad65435674a7e9d4?d=identicon)[Drarok](/maintainers/Drarok)

---

Top Contributors

[![Drarok](https://avatars.githubusercontent.com/u/55830?v=4)](https://github.com/Drarok "Drarok (18 commits)")[![itunali](https://avatars.githubusercontent.com/u/199362?v=4)](https://github.com/itunali "itunali (4 commits)")[![Dismounted](https://avatars.githubusercontent.com/u/103888?v=4)](https://github.com/Dismounted "Dismounted (2 commits)")[![johanlindblad](https://avatars.githubusercontent.com/u/508113?v=4)](https://github.com/johanlindblad "johanlindblad (1 commits)")

### Embed Badge

![Health badge](/badges/drarok-kotal/health.svg)

```
[![Health](https://phpackages.com/badges/drarok-kotal/health.svg)](https://phpackages.com/packages/drarok-kotal)
```

###  Alternatives

[limenius/react-bundle

Client and Server-side react rendering in a Symfony Bundle

3861.2M](/packages/limenius-react-bundle)[area17/laravel-auto-head-tags

Laravel Auto Head Tags helps you build the list of head elements for your app

4616.0k](/packages/area17-laravel-auto-head-tags)[jelix/wikirenderer

WikiRenderer is a library to generate HTML or anything else from wiki content.

1712.2k1](/packages/jelix-wikirenderer)[webkinder/sproutset

A Composer package for handling responsive images in Roots Bedrock + Sage + Blade projects.

281.8k](/packages/webkinder-sproutset)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
