bastianallgeier/kirbycms — pull request #35 by vis7mac (2012-08-15 10:10:15+00:00)
Title: Made a "dynamic" cache function

As needed for plugins showing dynamic things like comments I added an eval() to cache the PHP code (not the output) but still echo it the right way.

That works like that:
In a template file (or snippet or plugin called from a template or whatever, it's all the same) you can write things like that, to echo PHP code:
```php
"; ?>
```
or access Kirby vars and helpers (bad example but works…):
```php
"; ?>
```

Then, exactly that (the PHP code) will be cached, but before outputting that to the browser, all that stuff will be evaluated to get the comments or whatever.
So all is cached (saving more time to generate output) but all stuff that needs to be dynamic is dynamic. :)

OK, the syntax above is not perfect, but otherwise it would be evaluated directly…