Created
September 11, 2017 20:10
-
-
Save rob-gordon/d21042a5e3c4850a299a63038dd50924 to your computer and use it in GitHub Desktop.
get partial
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
| function get_partial($path, $args = false) { | |
| /* Set any variables */ | |
| if ($args && gettype($args) == 'array') { | |
| foreach($args as $key => $value) { | |
| $$key = $value; | |
| } | |
| } | |
| include(locate_template('partials/'.$path.'.php')); | |
| /* Unset any variables passed for this partial */ | |
| if ($args && gettype($args) == 'array') { | |
| foreach($args as $key => $value) { | |
| unset($$key); | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment