Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@kinglozzer
Created June 3, 2016 10:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kinglozzer/fe08af4db771df1acb3a2690e96a03cd to your computer and use it in GitHub Desktop.
Save kinglozzer/fe08af4db771df1acb3a2690e96a03cd to your computer and use it in GitHub Desktop.
<?php
class MyTemplateProvider implements TemplateGlobalProvider {
/**
* @return array
*/
public static function get_template_global_variables() {
return array(
'CurrentURL' => 'get_current_url'
);
}
/**
* @return string
*/
public function get_current_url() {
return Controller::curr()->request->getURL(true);
}
}
// dev/build, then use in template with {$CurrentURL}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment