Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resource Router and MSM #36

Open
ghost opened this issue Jun 28, 2016 · 5 comments
Open

Resource Router and MSM #36

ghost opened this issue Jun 28, 2016 · 5 comments

Comments

@ghost
Copy link

ghost commented Jun 28, 2016

Does Resource Router work with MSM, and could you provide some examples/suggestions of how to use it with MSM?

Thanks

@ghost
Copy link
Author

ghost commented Jun 30, 2016

Any answers on this? We are attempting to use it with EE3 and need to find out if it will work for us.

@rsanchez
Copy link
Owner

There's no specific integration with MSM, but I think it should be possible.

You can check for site ID in your route callbacks:

$config['resource_router'] = array(
    'blog/:url_title' => function ($router, $wildcard) {
        $site_id = ee()->config->item('site_id');
        // this route is only meant for the main site
        if ($site_id != 1) {
            return $router->set404();
        }

        return $router->setTemplate('blog/_detail');
    },
);

@roberthallatt
Copy link

You can also use a case statement that does a check on the domain name allowing you to prevent the code from being executed by another site in your MSM install.

@ghost
Copy link
Author

ghost commented Sep 22, 2017

@roberthallatt could you provide an example of how to do this?

@roberthallatt
Copy link

roberthallatt commented Sep 22, 2017

@ashleymarchant It would look something like this:

switch ($_SERVER['SERVER_NAME']){
        
     case "www.yoursite.com":

            $config['resource_router'] = array(
                your routes..
            );

     break;

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants