Jump to content

Looking for a reasonable approach to a page tree scenario...


thetuningspoon
 Share

Recommended Posts

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

  • 2 weeks later...
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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...