Created
August 17, 2012 20:20
-
-
Save westonwatson/3382289 to your computer and use it in GitHub Desktop.
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 display_object($object,$parameters,$action=null){ | |
//this is all a bit redundant, on purpose i guess... | |
$partial[name] = strtolower( get_class($object) ) . strtolower($action?"_{$action}":""); | |
//view to render | |
$partial[filename] = "{$partial_name}.phtml"; | |
//path to check with file_exists | |
$partial[path] = TRAX_ROOT . "/app/views/includes/" . $partial[filename]; | |
//path within app to use with render_partial | |
$partial[relative] = "includes/" . $partial[filename]; | |
//check for file | |
if (file_exists($partial[path])){ | |
//render partial for that object's class | |
$this->render_partial($partial[relative],$parameters); | |
}else{ | |
//debug, non-existent view display | |
echo "<pre>" . print_r($object,true) . "</pre>"; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment