Jump to content

Logic Question about manually sorting children belonging to multiple categories.


John W.
 Share

Recommended Posts

edit: before reading through all of this. Is there a way to have PW display a page array drop down list to select a Title vs having to type in the Title when creating a new (child) page?

 

---

I'm converting an old music site where custom built the back end to a responsive site and using processwire now as the back end.

In my old site I can add a song, attach it to multiple genres and within the list of genres manually sort the songs.

So here is what I have done in PW.

1. created a Genres page where I can add a child genre. The child genre is nothing but a template with the title field.

2. created a Artists page where I can add a child artist. The child artist is nothing more but a template with the title field.

3. I created a page called Songs.  The songs page uses a template that has the following fields:

title, song name, mp3 upload

a select box for selecting the artist from a pagearray (see 2)

a list of check boxes for assigning different genres to the song. (see 1)  (for instance, a song can be in the genres Pop AND Nostalgia

 

Thus :

HOME

Genres 3

  • Acoustic
  • Nostalgia

Artists 1

  • Elvis
  • The Eagles

Songs 2                 (fig. A)

  • Hound Dog
  • Blue Sued Shoes
  • Hotel California (acoustic)

What I'm trying to achieve:

I'd like to achieve a layout like this, or similar function that will let me add to a playlist of genres and be able to sort those songs manually without having to re-key each song for each genre.

Play Lists 3

Acoustic (2)

  • Blue Sued Shoes
  • Hotel California

Nostalgia (1)

  • Blue Sued Shoes

 

The Problem

As you can see, if I were to add a child (blue suede Shoes) to Acoustic or Nostalgia, I would have to basically use a "song" template and re-enter all the information about the song.

Ideally, it would be nice when adding a child to the Acoustic playlist I could just select a song already in Songs 2 (above). To get this type of listing in the back end:

 

All the genres and child songs able to be manually sorted.

Playlist 3

  • Acoustic 2
  •      Blue Sued Shoes
  •      Hotel California
  •  
  • Nostalgia 1
  •      Blue Sued Shoes
  •  
  • Pop 0

 

The only near solutions is to create a Genre template with a pagearray field which contains a repeater field for songs.

This would work on a site with few items per Genre, but, the repeater field would hit in performance if there were thousands of songs.

 

The only other though was to create a Play List page like so:

  • Acoustic (2)
  •      Blue Suede Shoes
  •      Hotel California
  • Nostalgia (1)
  •     Blue Sued Shoes

In this scenario,  the client adds a new child song to Acoustic. They would have to re-type the song title, press ok, then would be displayed a template that simply lets them select a song from drop-down that contains a pagearray containing the list of songs that I created see above (Fig. A)

For what I want to do, this seems to be the only solution. It's just invonvenient if they go change the name in the Songs list they would have to go into Acoustic and change the Title field there to match.

 

Ideally, if someone knows hows a way to modify PW to allow you to select an entry from a page array dropdown list vs the required Title field when creating a new child (page), that would be awesome!

 

Can anyone suggest some tips or insights if I have overlooked anything?

 

 

 

 

Link to comment
Share on other sites

The songs are already under a page called Songs where you only create one entry per song. The same with Genres and Artists.

 

Genres

  • Rock
  • Rap

 

Artists

  • Elvis
  • Eagles
  • Eminem

Songs

  • Blue Suede Shoes
  • Hotel California
  • Stan

When you create a song, like "Hotel California", you can use a pull down (pagearray) to select the artist and genre.

The problem is creating multiple playlists, where I can add songs to differing playlists and be able to sort the songs manually.

The attached photos might help. The only problem with this solution is if you add a (child) to Acoustic you have to re-type in the song Title, then on the next page, my pagearray drop-down will let you select a song from Songs.

 

 

Link to comment
Share on other sites

Maybe I'm misunderstanding something, but a Page field seems ideal for what you want to do. You leave the Song pages where they are (under Songs in the tree) and then select them in a "Songs" field in your "Playlist" template. Several of the available inputfields for a Page field allow you to sort pages in the field -  Autocomplete is a good option for selecting from a large number of pages but you could use AsmSelect or some other inputfield if you prefer.

In the screenshot below, imagine these "vegetable" pages are instead songs.

2017-01-06_144506.png

This way you don't need any child pages under your Playlist pages.

P.S. I think you forgot to add your screenshots.

  • Like 2
Link to comment
Share on other sites

Excellent!  For a quick test - I created a temp_playlist template which contains the title and a field called temp_song_selector. The temp_song_selector is a page field with an input type of PageListSelectMultiple that uses the songs stored in Songs. That input type which is user sortable is exactly what I was looking for -- or maybe thinking too hard overlooked it.

I'll play around with it tomorrow more in depth.

Thank you so much.

Link to comment
Share on other sites

Just one last question for future reference/projects. 

I only have a couple songs, not a huge set.

 Using PageListSelectMultiple input type.

How well does it handle a thousand items/songs when the page loads? 

I was kust thinking in that case it might be best to do somethink like;

Acoustic (1940's)

     song 1

     song 2

Acoustic (1960's)

     song a

     song b

Edited by holmescreek
Link to comment
Share on other sites

18 minutes ago, holmescreek said:

Using PageListSelectMultiple input type.

How well does it handle a thousand items/songs when the page loads? 

Not very well - that's when you would want to use an inputfield that loads options on demand with AJAX. I think Autocomplete is the only core inputfield that does this. Misread your post and thought you meant Select Multiple. Page List Select Multiple uses the standard ajax-paginated page tree so that is fine for thousands of pages, although slower to use than Autocomplete.

Inputfield Selectize is based on selectize.js which does have an AJAX load feature but I'm not sure this is available for pages in the PW module.

  • Like 1
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...