Last active
January 24, 2019 18:59
-
-
Save StolenThunda/9067b7d42800bf4aa363f02c5ac1b9a4 to your computer and use it in GitHub Desktop.
This file contains 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 dm_view($view, $path, data=array() ) { | |
$CI =& get_instance(); | |
$tp = $CI->load->_ci_view_path; | |
$CI->load->_ci_view_path = $path; | |
$out = $CI->load->view($view,$data,true); | |
$CI->load->_ci_view_path = $tp; | |
return $out; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-- Views in template tags
Whilst Ellis Labs might not like the use of front end views, as a PHP dev it’s one of the best things about EE2. With most of my projects the end client has nothing to do with the templates so a module tag that outputs based on views is no issue.
However, there is some housekeeping to do if you’re going to switch to views, as you need to change the view path back in case something else is using it. A helper function similar to this is useful: