What are the Slack Archives?

It’s a history of our time together in the Slack Community! There’s a ton of knowledge in here, so feel free to search through the archives for a possible answer to your question.

Because this space is not active, you won’t be able to create a new post or comment here. If you have a question or want to start a discussion about something, head over to our categories and pick one to post in! You can always refer back to a post from Slack Archives if needed; just copy the link to use it as a reference..

Hi all, If I wanted to check the URL on loading the page (for example `

ULL0N440J
ULL0N440J Posts: 184 πŸ§‘πŸ»β€πŸš€ - Cadet
edited October 2019 in Help

Hi all,
If I wanted to check the URL on loading the page (for example [shop.com/login](http://shop.com/login) ), how should I do that? In the indexController of that page?

My scenario is: I have different login-Pages with different themes. When I am on the page [shop.com/carparts/login](http://shop.com/carparts/login) I want to see a different theme than if I go on [shop.com/bikeparts/login](http://shop.com/bikeparts/login).
Currently I can only check this during login (based on the company for the current customer). I want to extend this to checking the given URL/ parameter. Any thoughts on this? πŸ™‚

Comments

  • UM53ZHLTF
    UM53ZHLTF Posts: 43 πŸ§‘πŸ»β€πŸš€ - Cadet
    edited October 2019

    have you tried defining your own controller like $this->createController('/{themePattern}/login', static::ROUTE_DYNAMIC_LOGIN, 'DynamicLogin', 'Login', 'index') ->assert('themePattern', $this->getAllowedLocalesPattern() . 'some-theme|antoher-provider') ->value('themePattern', 'them-pattern') ->assert('themePattern', 'valid-regex';

  • ULL0N440J
    ULL0N440J Posts: 184 πŸ§‘πŸ»β€πŸš€ - Cadet

    I think I actually only need to define a /src/Pyz/Yves/MyLogin/Plugin/Provider/LoginPageControllerProvider.php for every login page I have. I will take use of the view and the default controller. The theme will be overwritten at somewhere else

  • ULL0N440J
    ULL0N440J Posts: 184 πŸ§‘πŸ»β€πŸš€ - Cadet

    So, following my example from above it should be (just changing the URL)

    protected function addLoginRoute()
        {
            $this->createController('carparts/{login}', self::ROUTE_LOGIN, 'CustomerPage', 'Auth', 'login')
                ->assert('login', $this->getAllowedLocalesPattern() . 'login|login')
                ->value('login', 'login');
    
            return $this;
        }
    
  • UM53ZHLTF
    UM53ZHLTF Posts: 43 πŸ§‘πŸ»β€πŸš€ - Cadet
    edited October 2019

    the benefit of using a ->assert('themePattern', $this->getAllowedLocalesPattern() . 'some-theme|antoher-provider') is that $themePattern could be used in the controller further on. So you don't have define the same for any different provider

  • UKTSRTD5M
    UKTSRTD5M Posts: 77 πŸ§‘πŸ»β€πŸš€ - Cadet

    we have solved a similar issue in nginx - we are setting an environment-value based on the domain. But this should also be possible based on location... fastcgi_param APPLICATION_THEME bikeparts;