Jump to content
John Kelleher

Am I right - does this work for Processwire?

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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Craig,

  thanks for the quick and comprehensive reply. This fits with my 'take' on PW and makes it a good fit for other similar projects.

Rgds,

J

Share this post


Link to post
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

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By DooM
      Hello guys,
      I'm trying to figure out how to sync fields and templates between staging and production environments.
      I've found Migrations module by Lostkobrakai, but with use of it all the fields and templates must be created by API, which is kind of uncomfortable.
      I also tried ProcessDatabaseBackups module which can export only certain tables, but I don't think it's the best practice to do that.
      How do you guys solve this problem? It's very annoying to setup everything three times (dev, staging, production).
      Thanks a lot :)
    • By iipa
      Hi everybody!
      I have been reading about Multisite, but it kinda bugs me that every topic talks about having both admin and database same for multiple sites.
      I have a project where customer tests it by adding content to the site, while I still need to do some changes here and there in code, maybe some in database. If something crashes for a while, customer can't keep testing, which is a bit problematic.
      Is there any way that I could have two separate versions of one site ("production" and development) that share the same database, but are otherwise independent? Just the thought of having to migrate database every time I want to show client something new gives me anxiety 😁
    • By Falk
      Hi!
      After temporarily using Module Image Extra, which I completely removed, I had some troubles with my imagefield (unused table columns).
      So I just imported a previous version of this column via PHPmyAdmin, which worked pretty well.
      Anyways, in Processwire Backend all image tags are gone, although they are OK in the database.
      Other image related things work (thumbnail, title etc are OK).
      Is there any way to recreate all the images or something? Or may this be an cache-related issue?
       
      Thanks in advance 😃
       
    • By anttila
      We have many booking calendars made with ProcessWire (own databases) and I want to do a web app (SQL) which allows user to log in. First, the user chooses the right calendar and then (s)he have to log in. The user can be from any of those calendars and the app is not running on ProcessWire (it can if necessary). So if there any way to make sure that the user has rights to the calendar (s)he tries to log in and if the password is correct.
      Is there any better way to do this? I could also use PIN codes or something, but those need to be encrypted too.
      Multiple ProcessWires A lot of users per ProcessWire Everyone can log in to the web app (when using right calendar)
    • By nuel
      Hi there
      Basically I want to call code within a ProcessWire page that isn't used as a template. Example: www.mypwpage.com/myphpfile.php
      I have a working PW Website with a couple of pages like /artists, /releases, /videos etc. Now I need a page /download without any editable fields in the backend, just calling some PHP code (that was coded by another guy) containing a form that checks unique download-codes in a second database and starts the download of the desired file. The script is working fine right now as part of a static website, but since I built PW behind the site, this independent «Download Section» of the page doesn't work anymore.
      Right now I have the main file download.php as a page template on a newly created empty page called /download, so until now the form is working (wow). After sending the form containing the download-code, the file check_code.php in a subfolder /site/templates/download is called and that's where I get an error.
      Any help?
×
×
  • Create New...