thetuningspoon Posted June 19, 2017 Share Posted June 19, 2017 I'm working on an application in ProcessWire which allows users to have their own publicly accessible storefronts. I'm struggling to figure out how this should be represented in the URL/page tree. The ideal finished product would put the user's storefront at a unique url like https://www.example.com/username/store/ The cart, checkout, and products pages would follow the same structure: https://www.example.com/username/store/cart/ https://www.example.com/username/store/checkout/ https://www.example.com/username/store/product/ And so on... The problem is that I don't want to have to create a whole new section of the page tree for each new user. So, in effect, I want a url segment (the /username/ bit) that appears before the page name rather than after it. As far as I know, this isn't possible in PW. Another approach would be to use a query string variable to identify the user (e.g. https://www.example.com/store/?user=1234 ). This solves the problem of having to create a different tree for every user, but the URL is not nearly as convenient for customers, and it would require passing the parameter through all of my links. I suppose I could use query string parameters but then provide a more friendly URL to redirect there, but that doesn't feel quite right to me either. Anyway, I'm sort of thinking out loud here. Any other ideas? Link to comment Share on other sites More sharing options...
LostKobrakai Posted June 19, 2017 Share Posted June 19, 2017 Maybe use url segments for the whole url and just render the pages located elsewhere based in the infos supplied by the url. 6 Link to comment Share on other sites More sharing options...
mr-fan Posted June 20, 2017 Share Posted June 20, 2017 like @LostKobrakai wrote are url segments for the whole store your weapon of choice... if you could live with http://www.example.com/store/username/ and then /username/chart/....and so on you could all serve it from the /store/ template as routing to the needed data and users... 1 Link to comment Share on other sites More sharing options...
thetuningspoon Posted June 30, 2017 Author Share Posted June 30, 2017 Thanks, that could be a good option. It doesn't feel very "ProcessWirey" or very scalable to me though. But I guess I'm not even sure how this would typically be handled outside of PW, either. Link to comment Share on other sites More sharing options...
mr-fan Posted June 30, 2017 Share Posted June 30, 2017 4 hours ago, thetuningspoon said: It doesn't feel very "ProcessWirey" or very scalable to me though if you dive deepinto URL segments you will feel some "ProcessWires", too It's just to build the urls/structur that you need independently from your content storage in page tree...this is very scalable since you can optimize your pagetree (for editors, contenttype, datastructure) and the frontend presentation seperately. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now