I have a controller that displays a page depending on whether a user has already signed up for something when initially registering for the site.
If their organisation has already been registered, the page shows their profile which they can edit etc. (That bit works fine) But if they haven't the page is supposed to show a registration page where they can sign up
I've done this using:
$this->call('\Controllers\RegisterOrgController');
The user has an option of a free basic package, or a premium/premium plus package, which will require the user to be redirected to a payment page. My problem is, while this does show the registration page, it just registers the organisation when they choose 'premium' or 'premium plus' and doesn't show a payment page.
I know that it would be best to extend the organisation registration page from the profile page to get it to use the functionality; however, as the organisation profile page is primarily supposed to display a profile, I have it extending its own controller (from my recollection, you can't extend two classes) and using the register organisation controller to display the form.
I've seen ways to redirect pages in javascript, angularJS asp.net/C# but none of them have worked so far when adapted for PHP
I was thinking of setting the header:
header('location: ' . [function to get URL for new location]);
But this wouldn't work as the path is a subpath (register/organisation) and 'register' cannot be viewed if the user is logged in and the organisation profile has its own path name (organisation-profile).
TL;DR: it there a way to display a page by calling a controller that does this from another controller and still have the functionality, despite having a different path
Any help would definitely be appreciated, Thanks in advance!