Last active
April 28, 2020 19:49
-
-
Save artistro08/d58e9453f764d65534d0b24b96d35dc9 to your computer and use it in GitHub Desktop.
Add MD5 PHP function to OctoberCMS without a Plugin
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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