Module want: Repeatable elements
#1
Posted 24 January 2011 - 11:49 AM
Loving the look of processwire so far, walks the line very nicely between a simple 'page based' cms and more powerful solutions - thanks for all your hardwork.
One thing I think would be an awesome addition is a module to enable repeatable elements, somewhat like the Matrix expression engine plugin (http://pixelandtonic.com/matrix).
I guess this would work as a field type similar to the Fieldsets but called Repeatable and effectively allow the editor of a page to add a new 'row' of repeatable elements defined in the template.
Bit of a braindump but I hope this makes sense!
Al
#2
Posted 24 January 2011 - 01:42 PM
Not sure I understand your needs though. What do you want to do with this repeatable? Because basic idea of PW is that everything is repeatable. You just define new 'template' type.
And then, in the one template that should show this 'repeatables', you API your pages of that repeatable template based on their location/other paramaters like this:
echo $page->body; //echo something from the 'page with repeatables'
$reps = $pages->find('template=repeatable, ...params');
foreach($reps as $rep){
//here you go, array of 'repeatables' to go through
}
I know, sometimes it's hard to wrap your head around this seemingly endless possibilites, but in the end, you can gain a lot from having clear, custom defined structure. Everything is possible.
Edit: I mean, even if you look at this picture from Matrix plugin:
It really does resemble template creation
#3
Posted 24 January 2011 - 02:28 PM
There you could have Matrix for different events:
[table]
[tr]
[td]Minutes played[/td]
[td]Event type[/td]
[td]Player[/td]
[td]Team[/td]
[td]Details[/td]
[/tr]
[tr]
[td]12 min[/td]
[td]Goal[/td]
[td]A. Peisa[/td]
[td]Chelsea[/td]
[td]Chelsea leads 1-0[/td]
[/tr]
[tr]
[td]35 min[/td]
[td]Goal[/td]
[td]J. Litmanen[/td]
[td]Ajax[/td]
[td]1-1[/td]
[/tr]
[tr]
[td]72 min[/td]
[td]Red Card[/td]
[td]A. Peisa[/td]
[td]Chelsea[/td]
[td]Peisa is out of the game[/td]
[/tr]
[tr]
[td]88 min[/td]
[td]Goal[/td]
[td]J. Litmanen[/td]
[td]Ajax[/td]
[td]Ajax leads 1-2[/td]
[/tr]
[/table]
And those fields (or cells) are not only text, but also images, files, links, relations, dates etc...
This is ideal for situations where these are relevant data mainly for this template, they have to be easily updated etc. It would be really slow to create 1-20 different pages for every event for each game. I'm not sure if this is best example, but hope it makes this idea clearer.
I actually think that it would be better (and maybe easier module and more in line with current way of building sites), if we could add/edit/remove other pages through editing other page. I mean if I have two templates: soccer_game & soccer_game_event. Soccer game template has page reference field for multiple game events. This reference field could have some pretty ajax magic that it would allow creating new soccer game events right on soccer game page. It would be so nice
#4
Posted 24 January 2011 - 02:39 PM
Edit: I mean, even if you look at this picture from Matrix plugin:
It really does resemble template creation
It is true that you can achieve all the same results with pages & templates, but I think most important thing here is to make it easier for editors to create and manage the data. You can see the difference here:
(That little plus sign on the bottom is important -> You add more "rows" easily when editing the page)
But I also do not like that there is 2 very different ways to create same end result. So that is why I think that it would be better to allow creating & editing of other pages inside parent page.
#5
Posted 24 January 2011 - 02:58 PM
I'll write more in about an hour.
#6
Posted 24 January 2011 - 05:14 PM
#7
Posted 24 January 2011 - 06:30 PM
Seems like ProcessWire is already pretty close if you look at the images field type for example (see the way this works on the home page in the skyscraper demo - where you have the file and a description and can add new 'rows' for additional images). Seems like you could adapt that so you can add other fields to a field like that as well as to a template (in the way you just have description text field) and you'd be there? Of course I realise that's simple to say and more difficult to implement - but looking at how the fields are added in tables in the backend db then seems like the system would lend itself to that relatively easily?
#8
Posted 24 January 2011 - 07:03 PM
#9
Posted 24 January 2011 - 07:06 PM
Hey, that's actually pretty catcy headline!
Awesome foundation you'll love to build upon
#10
Posted 24 January 2011 - 11:03 PM
...The challenge would just be in making it configurable with any fields, and supporting a matrix display... most fieldtypes assume they aren't width limited. In addition, making the individual components of the fieldtype searchable/selectable with the API. But these things are already partially worked out.
Great! Yes, I was kind of thinking that it's one of those things that sounds simple but has a number of implications. I think the matrix display is less of an issue - even if the fields were full-width one above the other then you'd still get most of the benefits...
#12
Posted 25 January 2011 - 06:38 PM
#14
Posted 26 January 2011 - 10:11 AM
#15
Posted 26 January 2011 - 12:04 PM
The same way you define templates, you define 'partial-templates' [or 'repeatables'] and the only thing we would have to add as field would be something as 'repeatable-select', which would then point to one repeatable/partial template.
#16
Posted 26 January 2011 - 03:37 PM
#17
Posted 27 January 2011 - 03:48 AM
Ryan: It actually shows a need for deeper API documentation [hint hint]
#18
Posted 27 January 2011 - 11:42 AM
#19
Posted 27 January 2011 - 12:21 PM
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users













