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 `
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
-
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';
0 -
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 else0 -
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; }
0 -
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 provider0 -
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;
0
Categories
- All Categories
- 42 Getting Started & Guidelines
- 7 Getting Started in the Community
- 8 Additional Resources
- 7 Community Ideas and Feedback
- 76 Spryker News
- 929 Developer Corner
- 787 Spryker Development
- 89 Spryker Dev Environment
- 362 Spryker Releases
- 3 Oryx frontend framework
- 35 Propel ORM
- 68 Community Projects
- 3 Community Ideation Board
- 30 Hackathon
- 3 PHP Bridge
- 6 Gacela Project
- 26 Job Opportunities
- 3.2K π Slack Archives
- 116 Academy
- 5 Business Users
- 370 Docker
- 551 Slack General
- 2K Help
- 75 Knowledge Sharing
- 6 Random Stuff
- 4 Code Testing
- 32 Product & Business Questions
- 70 Spryker Safari Questions
- 50 Random