• Resolved 825andy

    (@825andy)


    I’m trying to add a column to the list table. I have created
    – placeholder field (tc_rpt)
    – added it to display fields for public
    – created custom template for the list

    I want the tc_rpt to load a single record template based on the rows RecordID.

    I’ve tried a number of things, I currently have this to help illustrate:

    <?php
    if ($this->field->name === ‘tc_rpt’) {
    $this->field->link = $record->echo do_shortcode(“[pdb_single template=’customtc’]”);
    }
    $this->field->print_value() ?>

    It is located here:

    <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 class=”<?php echo $this->field->name() ?>-field”>

    <?php

    if ($this->field->name === ‘tc_rpt’) {
    $this->field->link = $record->echo do_shortcode(“[pdb_single template=’customtc’]”);
    }
    $this->field->print_value() ?>
    </td>

    <?php endwhile; // each field ?>
    </tr>
    <?php endwhile; // each record ?>
    </tbody>

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author xnau webdesign

    (@xnau)

    You can’t set the $this->field->link property like that. The link property can only be set to a valid URL, your code won’t do that for several reasons.

    It will be easier to help if you describe what you’re trying to accomplish there.

    Thread Starter 825andy

    (@825andy)

    That makes sense.

    What I”m trying to do is add three columns for each record in the pdb list. The columns would have the letters TC, GP, and IR. Each of those two letters groups would be linked to a specific pdb-single template that I’ve already made. I am just having troubles with adding the columns with links to each of those unique templates.

    Thanks!!

    Plugin Author xnau webdesign

    (@xnau)

    This is something you can do using a Custom Template, and you’re going to need to need some pretty good php skills and knowledge of WordPress development to get that done.

    Taks a look at this article, it explains how to use a helper class to access Participants Database fields in a template:

    Using the PDb_Template Class

    I’m sorrry, I can’t provide custom code, you’ll need to do this on your own.

    Thread Starter 825andy

    (@825andy)

    I was able to fix this by creating a page that I set as the Single Record page in Pdb settings. The page had the following code:

    
     <?php
    /*
     * template for displaying a Report List
     *
     * single record template
     */
    // get the template object for this record
    $this_business = new PDb_Template($this);
    ?>
    
    <?php
    ob_start();
    echo $_GET['pdb'];
    $strid = ob_get_contents();
    ob_end_clean();
    ?>
    <a href="https://10.6.19.13/db/srtc/?pdb=<?php echo $strid?>">Target Characterization Report</a>
    <br/>
    <br/>
    <a href="https://10.6.19.13/db/srgp/?pdb=<?php echo $strid?>">Green Processing Report</a>
    <br/>
    <br/>
    <a href="https://10.6.19.13/db/srib/?pdb=<?php echo $strid?>">Iridium Bonding Report</a>
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Adding link to custom template in pdb-list’ is closed to new replies.