Skip to content

Instantly share code, notes, and snippets.

@artistro08
Last active April 28, 2020 19:49
Show Gist options
  • Save artistro08/d58e9453f764d65534d0b24b96d35dc9 to your computer and use it in GitHub Desktop.
Save artistro08/d58e9453f764d65534d0b24b96d35dc9 to your computer and use it in GitHub Desktop.
Add MD5 PHP function to OctoberCMS without a Plugin
// Put this in your code section in your layout
function onstart() {
$this['url_hasher'] = new class {
public function run($input) {
return md5($input);
}
};
}
Then call using this
{{ url_hasher.run('PUT INPUT HERE') }}
// need to pass a variable from a plugin? No problem. Contencate the code:
{{ url_hasher.run('PUT INPUT HERE' ~ this.page.title) }}
// Useful when using screenshotlayer.com's api
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment