Jump to content

Am I right - does this work for Processwire?


John Kelleher
 Share

Recommended Posts

I'm creating a site to showcase project work from my students. I know this is a breeze with my conventional SQL database and ASP.NET tooling but hopefully I can work this out in Processwire. Can anyone comment on whether this plan holds water?

Each Project has:

  • Name
  • Student members (1-4)
  • n photos or videos or audio clips

Obviously a page with a backing template with the appropriate field types works here. However, the members need to be selected from a separate list of Students. This suggests a PageReference field I reckon and a repeater to handle 1-4 Students.

I have student details (ID & Name & Programme of Study & Yr of Study) in CSV file so guess I can generate pages from that file to create a collection of Students.

I may want to filter Projects by 'Programme of Study' (from Student page). Should I create Student pages as a child page of 'Programme of Study' with maybe an in-between parent of 'Year of Study'? I might also permit access to the Project page only to those students who are members. So maybe setting Students up as users is the better way to go?

I guess I'm looking for guidance around how to implement foreign key relations as you would normally do for a database. I'm guessing there are performance issues around the kind of querying I might want to do but there are hopefully some rules of thumb around establishing relations between entities (pages) in Processwire.

Thanks,

John

Link to comment
Share on other sites

Hi John. ProcessWire will be able to handle all of that rather well :) This is how I would think about doing it...

Students and users

If you want some projects to only be accessible to students, then certainly add students as users. You can extend the "user" system template with additional fields for your extra data. Create a new role "student" to add to these users and to control permissions.

User

  • title (For full name)
  • name (permanent ProcessWire field - use this for student ID, perhaps?)
  • programme (FieldtypePage, for programme of study)
  • year (FieldtypePage or FieldtypeInteger)

Projects

  •  
  • title
  • body (FieldtypeTextarea)
  • images (FieldtypeImage. For images only)
  • files (FieldtypeFile. For video or audio)
  • students (FieldtypePage. Allow multiple. Use a custom selector value: template=user, roles=student)
  • programme (same FieldtypePage as above)

Each project would have their own page under a parent "Projects" page.

For the Programme of Study, presumably this is just a simple lookup/dropdown list? A common way of doing this in ProcessWire is to create a settings or configuration template (with minimal fields - usually just title) and (hidden) page tree. E.g.

/settings/programmes/
|-- Programme 1
|-- Programme 2
|-- ...

You can then create a Page field which will use something like template=settings, parent=/settings/programmes/ to allow selection of the programmes of study for both users and projects.

This makes it incredibly easy to generate a front-end filter for the programmes and build a page query selector string to find projects that belong to the programme of study.

Depending on the way you want to format or structure your year of study you could use the same process. But if it's just going to be the year in numeric format (like 2014) then you could just use an Integer type rather than a Page.

With that structure, there shouldn't be any performance issues.

  • Like 5
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

×
×
  • Create New...