Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am k127 on github.
  • I am k127 (https://keybase.io/k127) on keybase.
  • I have a public key ASAu2ZfuPDShN697fYNe7-yhHpimletBqsa4UuHGuVWgKgo

To claim this, I am signing this object:

@k127
k127 / page.html.php
Created August 19, 2016 12:00
A simple minimal example for preprocessing PHP template data
<?php
// We just preprocess some data to use for the template.
// For what we want to show, it is not important what we're doing here exactly,
// rather than the fact that this cannot be done inside a Twig template,
// which is where this PHP HTML template should be convertet to.
if ($image = filter_input(INPUT_GET, 'image') &&
!filter_var($image, FILTER_VALIDATE_URL) === false) {
$image_src = $image;