Determine if an object exists |
[eluser]Unknown[/eluser]
QUICK ACCESS: http://stikked.com/view/2a6e70a8 Save this file to 'Exists.php' in your libraries folder I needed to write this after determining that there was no inbuilt codeigniter way to determine if any particular object existed BEFORE trying to load it. Code: /* For easiest access, add 'exists' to the $autoload['libraries'] array in your config/autoload.php file. Call using $this->exists->[object]('object_name'); For example: Code: //Load a certain layout stylesheet if it exists, otherwise load the generic one Reasonably simple and elegant. Enjoy. Got this far and still wondering where to find the code? There's a link at the top of the post |
Welcome Guest, Not a member yet? Register Sign In |