Skip to content

Commit 91597cf

Browse files
author
Tabea David
committed
cleanup
1 parent 8a45e0c commit 91597cf

3 files changed

Lines changed: 2 additions & 7 deletions

File tree

README.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ For each controller that is outputting markup, a corresponding template file sho
3232
Depending on the setting "Global template file" of the activated engine, the factory tries to load the template file of the current page's controller or the global template file. If a template file is found, an instance of it is accessible over the API variable. If no template file is found, the factory assumes that the controller does not output markup over the template engine. In this case, the hook to modify the behaviour of Page::render() is not attached - everything works "normal".
3333

3434
The following example uses the ProcessWire template engine:
35-
3635
```php
3736
// In controller file: /site/templates/home.php
3837

@@ -53,7 +52,6 @@ $view->setMultiple(array(
5352
));
5453
```
5554
In the example above, some logic is processed if a form was sent. Note that there is no markup generated, because this should now be done by the corresponding template file! Over the new API variable `$view`, key/value pairs are passed to the template. Here is an example how the template file could look like:
56-
5755
```php
5856
// In template file: /site/templates/view/home.php
5957

@@ -69,7 +67,6 @@ In the example above, some logic is processed if a form was sent. Note that ther
6967
<?php endif; ?>
7068
```
7169
Assume there is installed the module "TemplateEngineSmarty" and Smarty is chosen as the active template engine. The template file could look like this:
72-
7370
```php
7471
// In template file: /site/templates/smarty/home.tpl
7572

@@ -88,7 +85,6 @@ The introduced API variable acts as a gateway to the active template engine. Thi
8885

8986
### Load and output markup of other template files
9087
Use the "TemplateEngineFactory" module to load any template file and output it's markup:
91-
9288
```php
9389
// In controller file: /site/templates/product.php
9490

TemplateEngineFactory.module

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ class TemplateEngineFactory extends WireData implements Module, ConfigurableModu
104104
}
105105

106106
$context = array_slice($event->arguments(), 1, null, false);
107-
$engine = $this->getInstanceById($this->get('engine'), $chunkFile, true, true);
107+
$engine = $this->getInstanceById($this->get('engine'), $chunkFile, true);
108108
if (is_null($engine)) return; // template file is missing
109109

110110
$chunkBaseFile = $this->config->paths->templates . $chunkFile . '.' . $this->config->templateExtension;
@@ -224,7 +224,7 @@ class TemplateEngineFactory extends WireData implements Module, ConfigurableModu
224224
* @return TemplateEngine|null
225225
* @throws WireException
226226
*/
227-
public function getInstanceById($class, $filename = '', $as_api_var=false, $chunk=false)
227+
public function getInstanceById($class, $filename = '', $as_api_var=false)
228228
{
229229
$installed = $this->getInstalledEngines();
230230
if (!in_array($class, array_keys($installed))) {

TemplateEngineProcesswire.module

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
<?php
22
require_once('TemplateEngine.php');
33

4-
54
/**
65
* TemplateEngineProcesswire
76
*

0 commit comments

Comments
 (0)