CodeIgniter Forums
Return a view from a Filter? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=11)
+--- Thread: Return a view from a Filter? (/showthread.php?tid=77063)



Return a view from a Filter? - mlurie - 07-16-2020

I have implemented a filter that runs reCAPTCHA v3 verification.  If the verification is successful, the post data is processed and e-mailed to the designated recipient(s).  If verification fails, I would like to return a view, but that doesn't seem to work. Instead, I am redirecting to an error page.  I would prefer that the error page not be accessible directly from a URL, so returning a view is preferable.  Is there a way to return a view directly from a filter, or is it necessary to use a redirect?


RE: Return a view from a Filter? - mlurie - 07-17-2020

I figured out a workaround, but I'm not sure if this is proper or just a hack:

PHP Code:
echo view('view_name');
exit();