Discussion
· Dec 15, 2023

CSP Pages versus Classes extending from %CSP.Page

Hi all,

The last time I used CSP was back in 2008, so I am very rusty on it.
This question might have been asked many times, and the answer probably is that it is a matter of preference.

Are there scenarios to which CSP pages is easier/better to use than classes extending from %CSP.Page?
I want to build a little thing and don't want to start at the wrong end.
Doing an API-based, heavy client-side framework is not a requirement, and I would prefer not to do it that way.

Some of the criteria

  • Users need to do a login.
  • RBAC per page using the instance's Users, Roles and Resources
  • Call some server-side methods, natively or with javascript (open to any of the two)
  • Mostly server-side rendered.
  • Most readable code.

I know this is a subjectively opinion based question, but would like some input.

Thank you

Discussion (4)2
Log in or sign up to continue

I want the class route.

I did a lot of abstraction for the UI, like the page header, sidebar (menu) and footer. Re-usable classes for each of these page sections, as well as being able to create a "template" page to extend from, then let each specific page add its content into it. I also needed security on menu items and resource access control across pages, so abstraction made sense.

I did it a bit like you would with Django templates.

I might post an example of how I did this at some point. I used the Material Dashboard Pro UI framework, so I can't share that specific content due to copyright issues on the CSS and JS included.