Jump to content

Recommended Posts

Posted (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 by Martijn Geerts
  • Like 13
Posted

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?

 
Posted

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. 

  • Like 1
Posted (edited)

@KaMeKuN, please talk in forum and not in PM.

If things are confusing for you, it might be confusing for others to.

Edited by Martijn Geerts

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.
×
×
  • Create New...