Jump to content
Server Maintenance This Week. ×

Hyperlink in the table view of records in php


This topic is 4127 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Let’s see if I can explain this in a coherent manner. I am displaying fields in a table view of records in a php webpage. I need to hyperlink the values in the table with calculated values using other field values. Is this possible?

 

And example of part of the code is:

...

 

 <?php
                                                            $recnum = 1;
                                                            foreach ($records as $fmrecord) {
                                                                    $record = new RecordHighlighter($fmrecord, $cgi);
 
                                                                    $rowclass = ($recnum % 2 == 0) ? "table_row" : "alt_row";
                                                                    $recid = $record->getRecordId();
                                                                    $pos = strpos($recid, "RID_!");
                                                                    if ($pos !== false) {
                                                                         $recid = substr($recid,0,5) . urlencode(substr($recid,strlen("RID_!")));
                                                                    }
                                                            ?>
                                    <tr class="<?php echo $rowclass ?>">
                                        <td class="browse_cell left">
                                            <?php echo nl2br(str_replace(' ', '&nbsp; ', $record->getField('NT', 0) ))?>
                                        </td>
                                        <td class="browse_cell left">
                                            <?php echo nl2br(str_replace(' ', '&nbsp; ', $record->getField('Track 1', 0) ))?>
                                        </td>
                                        <td class="browse_cell right">
                                            <?php echo nl2br(str_replace(' ', '&nbsp; ', $record->getField('Track 2', 0) ))?>
...
 
So what I need is that when it displays the records the value in field “NT” for instance, is a hyperlink that is calculated in "Field X"
 
I am hoping this is easy and I think I have done it before, but my brain isn’t working due to lack of sleep. 
 
Help!!! And thanks. 
Link to comment
Share on other sites

If that field is on the layout, then something like:

<a href="<?php echo $record->getField('FieldX')?>"><?php echo nl2br(str_replace(' ', '&nbsp; ', $record->getField('NT', 0) ))?></a>

Should do the trick (assuming it's a full or relative hyperlink) - might need the , 0 bit as well?

Link to comment
Share on other sites

This topic is 4127 days old. Please don't post here. Open a new topic instead.

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

Important Information

By using this site, you agree to our Terms of Use.