Martijn Geerts Posted September 27, 2013 Posted September 27, 2013 (edited) Started a new module for creating <tables> from repeater fields. Feel free to grab it from github, do with it what you want. It only works for simple text based fields inside a repeater. To use it: $table = $modules->get("RepeaterTable"); // initialize $table->thead = true; // (bool) true/false, default = true, will render <th> $table->indent = 3; // (mixed) false/int, where int is the level of indentation, default: false $table = $table->render($page->repeater); // repeaterfield called repeater <!-- output --> <table class="table-repeater"> <thead> <tr> <th class="col-1">Fieldlabel field 1</th> <th class="col-2">Fieldlabel field 2</th> <th class="col-3">Fieldlabel field 3</th> </tr> </thead> <tbody> <tr class="row-1"> <td class="col-1">data for field 1, first repeater item</td> <td class="col-2">data for field 2, first repeater item</td> <td class="col-3">data for field 3, first repeater item</td> </tr> <tr class="row-2"> <td class="col-1">data for field 1, second repeater item</td> <td class="col-2">data for field 2, second repeater item</td> <td class="col-3">data for field 3, second repeater item</td> </tr> </tbody> </table> For the HTML purist, I have added source code indentation where you can set how many tabs you wish to append before each element. Please let me know if I should add this to the modules directory ? Does someone have a good name for this ? Edited September 28, 2013 by Martijn Geerts 13
Macrura Posted September 27, 2013 Posted September 27, 2013 nice! i've done a lot of tables from repeaters... this might come in handy...
Martijn Geerts Posted September 28, 2013 Author Posted September 28, 2013 You're welcome. For me building tables is always time consuming.
KaMeKuN Posted October 1, 2013 Posted October 1, 2013 You're welcome. For me building tables is always time consuming. Thanks for you module, im trying to do this: http://processwire.com/talk/topic/4640-repeater-item-collapsed/#entry45355
owzim Posted October 1, 2013 Posted October 1, 2013 That's going to save a lot of time, thank You! Do you intend to make the output customizable in the future? Like soma did with his MarkupSimpleNavigation?
Martijn Geerts Posted October 2, 2013 Author Posted October 2, 2013 I have no plans to develop it further then this. For me it's just a time saver to build tables. If more people really like this module I can continue on this one. And add it to the modules directory to. Can imagine I build in support for normal PageArray, manipute output etc. 1
Martijn Geerts Posted October 2, 2013 Author Posted October 2, 2013 (edited) @KaMeKuN, please talk in forum and not in PM. If things are confusing for you, it might be confusing for others to. Edited October 2, 2013 by Martijn Geerts
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now