CodeIgniter Forums
How to 'serve' file from the 'public' folder!? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forum-28.html)
+--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forum-30.html)
+--- Thread: How to 'serve' file from the 'public' folder!? (/thread-77605.html)



How to 'serve' file from the 'public' folder!? - blaasvaer - 09-23-2020

Bam! Baffled again.

OK, I'm 'trying' to implement some sort of themes control and get kicked in the balls ...

I have this (excerpt):

Code:
if ( $indexphp ) {
    $this->_render_page( array(
        ROOTPATH . 'public/themes/' . $this->active_theme . '/' . $page,
    ), $this->data );
} else {
    $this->_render_page( array(
        ROOTPATH . 'public/themes/' . $this->default_theme . '/index.php'));
}

HOW do I serve an index.php file from the 'public' folder!? The file IS THERE, but I get a:

Code:
CodeIgniter\View\Exceptions\ViewException

Error. What am I doing wrong (again, again)?

I get that a Controller somehow 'automatically' points to 'Views' directory, but HOW do I change that to the 'public' folder for doing something like this? Or maybe I'm – once more – NOT getting how to 'use' CI 4 properly.


RE: How to 'serve' file from the 'public' folder!? - InsiteFX - 09-23-2020

app/Config/Paths.php


RE: How to 'serve' file from the 'public' folder!? - blaasvaer - 09-24-2020

(09-23-2020, 04:23 PM)InsiteFX Wrote: app/Config/Paths.php

Thanks. And that will allow me to?

I don't want to change the 'default' path ... I only need to do this on a per 'request' basis for specific methods ...