question : SaaS style URLs , HMVC , Dev Footer |
Hi All,
I am starting out in CI4 and have 3 questions : ![]() 1. My project is a SaaS type project and currently in CI3, I use this: //if(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on"){$ssl_set = "s";} else{$ssl_set = "";} //public $baseURL = 'http'.$ssl_set.'://'.$_SERVER['HTTP_HOST']; but in App.php in CI4, it only excepts a function or a constant -- so how do I set this up so that I can use multiple URLs ? 2. I currently use the HMVC plugin, so each module currently has its own controllers/models/views How do I achieve like this in CI4 ? -- a small example if possible .. 3. How do I get to show that development footer : ![]()
SEE: This Website
Modules in CodeIgniter 4 Read all the other Blog posts as well. What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
(06-16-2018, 03:27 AM)InsiteFX Wrote: SEE: This Website Hi, So currently using HMVC, I can do something like template/one/ which calls view layout_out then from my controller, i pass this view for $data and content is loaded fine. But in the layout_one view itself, i have multiple divs ( say for banners, footer, header) and from that view itself, I call it like this: echo modules::run('banner/promotions'); echo modules::run('page/footer'); echo modules::run('sidebar/nav'); so curerntly, a controller calls a page .. where it displays the data, but the page itself calls multiple other controllers to display parts .. making CI very flexible like any wordpress/joomla module with template etc. But in CI4, i read that there will be no ability to do anything like this ( the view will be just a view without even ability to run php) so how is the above kind of use-case handled in CI4 ? Thanks,
You need to read the CodeIgniter 4 Documentation on Views and View Cells.
CodeIgniter 4 User Guide What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
for dynamic URL,
in config/autoload.php i find this reference => require_once BASEPATH.'Config/AutoloadConfig.php'; while that file does not exist. I created that AutoloadConfig.php and put this: <?php namespace Config; if(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on"){ $ssl_set = "s"; } else{ $ssl_set = ""; } MYURL = 'http'.$ssl_set.'://'.$_SERVER['HTTP_HOST']; and then in the App.php public $baseURL = 'MYURL'; Doesn't work ![]()
You should not need any of that, the ,htaccess file that comes with CodeIgniter 4 checks all that for you.
You should just need to set the base url to the https://server_name What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
(06-20-2018, 04:08 AM)InsiteFX Wrote: You should not need any of that, the ,htaccess file that comes with CodeIgniter 4 checks all that for you. Sorry .. let me try to rephrase (english is not my first language) I have a SaaS style project where people get dynamic subdomains so when companyA signs up, the base URL is companyA.domain.com if they set it to company.com and forward to our A record, then the app is displayed as company.com in CI3, the following allowed to setup a dynamic base_url if(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on"){$ssl_set = "s";} else{$ssl_set = "";} public $baseURL = 'http'.$ssl_set.'://'.$_SERVER['HTTP_HOST']; what is the equivalent method to do that in CI4, so that we can still continue to develop SaaS applications where accessing the same via multiple subdomains or multiple-domain name is possible. |
Welcome Guest, Not a member yet? Register Sign In |