I’m making an accessory that can process an AJAX call. In the function that processes the call, I am trying to load a view file, but I’m getting a 500 internal server error instead.
This doesn’t work:
$out = $this->EE->load->view('available', $data, TRUE);
exit($out);This doesn’t work:
exit($this->EE->load->view('available', $data));This does work:
$out = 'Hi there!';
exit($out);I saw that there was a previous thread about this issue, and that it was marked as a bug which was apparently resolved in EE 2.1.1. Am I missing something here or is this still not working?
EDIT: Forgot to mention I’m using EE 2.1.3.
This is apparently a known issue for the current 2.1.3 build (20110411). I fixed it by changing line 211 and 213 in system/expressionengine/controllers/cp/addons_accessories.php from:
$this->load->add_package_path(PATH_THIRD.strtolower($class).'/');
...
$this->load->_ci_view_path = PATH_THIRD.strtolower($class).'/views/';to:
$this->load->add_package_path(PATH_THIRD.strtolower($name).'/');
...
$this->load->_ci_view_path = PATH_THIRD.strtolower($name).'/views/';Thanks go to Greg Ferrell for the quick fix!
Another fix is to set the path in my accessory, and then once I’m done, set it back.
$orig_view_path = $this->EE->load->_ci_view_path;
$this->EE->load->_ci_view_path = PATH_THIRD.'accessory_name/views/';
*Process the view file*
$this->EE->load->_ci_view_path = $orig_view_path;Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.