You just need to use the same customization that is used on the default list template, apply it to the “detailed” template, they both work the same in the section that shows the list of records.
To export a CSV, first, make sure all the fields you want exported hace “CSV” checked in the field definition. Then,on the “list participants” page in the admin, click on the export CSV button at the bottom of the page.
Thread Starter
jmcria
(@jmcria)
I tried the edit_link edit on on the detailed template but I must have it in the wrong location. I put it on either side of the “echo PDbFormElement… line without success. This the code:
` <tbody>
<?php while ( $this->have_records() ) : $this->the_record(); // each record is one row ?>
<tr>
<?php while( $this->have_fields() ) : $this->the_field(); // each field is one cell ?>
<td>
<?php
echo PDb_FormElement::get_field_value_display($this->field);
// IF STATEMENT ADDED FOR CUSTOM2
if ($this->field->name == ‘edit_link’) {
$this->field->link = $record->get_edit_link();} ?>
//
</td>`
As you can see I am not very strong on php. If you could send me a code snippet showing where the IF statement goes would be very helpful.
Thank you for the CSV download directions. You have a large site and I thought I looked everywhere.
Thank you for your quick response
I know the documentation is not well organized…hard to find the time to tidy that up.
You got the code mostly right, you just need to do your if statement before the echo so that it is changed before it gets displayed.
Thread Starter
jmcria
(@jmcria)
You will have to be more specific with the template edit code. Whenever I insert the “edit_link” if statement into the detailed template (sortcode: [pdb-list template=custom2]) the search goes into an endless loop regardless of which side of the echo command. Custom2 template works as expected when all of my edits are commented out.
Note: the // comment tag in the code snippet from the earlier post is out of place but that has been corrected.
Thank you again and sorry I am slow. Participants Database will be a valuable addition to our website.
Well, I’m not really in a position to debug your template, I’m sorry. It is assumed you have enough knowledge of PHP to avoid minor issues like you describe. Try this…I don’t know if t will fix your template, but this is the error I see in what you showed me…you have a section like this:
<?php
echo PDb_FormElement::get_field_value_display($this->field);
// IF STATEMENT ADDED FOR CUSTOM2
if ($this->field->name == 'edit_link') {
$this->field->link = $record->get_edit_link();} ?>
change that to:
<?php
// IF STATEMENT ADDED FOR CUSTOM2
if ($this->field->name == 'edit_link') {
$this->field->link = $record->get_edit_link();}
echo PDb_FormElement::get_field_value_display($this->field);
?>
and it should work.
Thread Starter
jmcria
(@jmcria)
I noticed that $Record is never defined in pdb-list-detailed.php so I added
$record = new PDb_Template($this);
just below
while ( $this->have_records() ) : $this->the_record();
Everything works fine now!
Thank you. You have a great plugin!