Jump to content

Advice is needed on the structure of the pages


Pixrael
 Share

Recommended Posts

Hi, I am trying to organize a new project (admin UI style) and the urls structure should be as follows:

/products/                                   Products list
/products/discontinued              Products list filtered
/products/draft                           Products list filtered
/products/new                             New product form
/products/edit/P0123456789     Edit product form
/products/inventory                    Inventory page
/products/P0123456789              Product detail view

I am analyzing that if I implement the page relationships in the regular Processwire way for routing, I will end up having something unwanted like this:

home
- products
  -- new
  -- P0123456789
  -- edit
  -- P0123456788
  -- P0123456787
  -- inventory
  -- P0123456786

I was thinking in a page structure that contains "static" pages in a "visual" tree and keep constantly growing pages/data in a separate Tree node, then use urlSegments to load/display them, it will be something like this:

home
- products
  -- new
  -- edit
  -- inventory
- data
  -- products
     -- P0123456789
     -- P0123456788
     -- P0123456787
  -- shipments
     -- S0123456789
     -- S0123456788
     -- S0123456787
  -- orders
     -- D0123456789

Having activated URLSegments in the Products list template I can do the following:

/products/                              ("list-products.php" all products)
/products/discontinued        ("list-products.php" filter products with urlSegment)
/products/draft                     ("list-products.php" filter products with urlSegment)

 

But for the Product details view case, I have Four possible scenarios here:

 

1st. The product node (in the "data" nodes) will have the template file "detail-product.php" assigned to it. The "list-products.php" will use urlSegment to render the requested product page instead of rendering its own "list-products.php" markup.

ex: /products/0123456789

 

2nd. A "item" node with template file "detail-product.php" assigned, will use urlSegments to load product info from "data" product nodes. In this case product nodes do not have template file associated, they only store information. If the url "/products/items/" is requested without segment, it will redirect to parent "/products/".

ex: /products/item/0123456789

The "static" page structure will ending like this:

home
- products
  -- new
  -- edit
  -- item
  -- inventory

 

3rd. Following the 2nd scenario, have the product pages directly in the "item" node (the natural processwire structure, no urlSegment implemented).

ex: /products/item/0123456789

The page structure will ending like this:

home
- products
  -- new
  -- edit
  -- item
     -- P0123456789
     -- P0123456788
     -- P0123456787
  -- inventory

 

4th. Is the inverse solution to 1st. scenario. Have the product pages directly in the products list node (the PW way), and use the urlSegments in Product list page for the other operations. For ex. New, Edit, Inventory, etc. will be rendered instead the Product list page. The markup of this pages should be placed in other hidden nodes or can be placed only in the file system.

 The page structure will ending like this:

home
- products
  -- P0123456789
  -- P0123456788
  -- P0123456787

 

What do you think? Which option is better: the first or the second? Do you think there is another way to organize this?

PS: I know that it's a bit heavy to be asking about this again, but is an important decision for a complex project.. and maybe the answers here will serve in the future for someone else in the same situation.

Thanks

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...