Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Creating a link


Reply


3 Posts   647 Views

Avatar
Harley

Community Member, 153 Posts

31 January 2010 at 4:55am

Hi, I have created a relational database to display a log of details. The details are quiet extensive so for the sake of displaying them I have this condensed table as you will see below. What I want to do is link from each row to a page of its own which displays the entry in its entirety.

I have not defined a function for $Link, this is the part I am having trouble with. Any ideas on how I do this? Thanks

<div class="typography">
      <h2>$Title</h2>
      <table>
      <thead>
      <tr>
         <th>Date</th>
         <th>First name</th>
         <th>Surname</th>
         <th>Gender</th>
         <th>D.O.B.</th>
         <th>&nbsp;</th>
      </tr>
      </thead>
      <tbody>
         <% if CallEvent %>
         <% control CallEvent %>
         <tr>
            <td>$Created.Nice</td>
            <td>$PersonDetail.FirstName</td>
            <td>$PersonDetail.Surname</td>
            <td>$PersonDetail.Gender</td>
            <td>$PersonDetail.DateOfBirth.Nice</td>
            <td><a href="$Link">Full details</a></td>
         </tr>
         <% end_control %>
         <% else %>
         <tr>
            <td colspan="2">No records</td>
         </tr>
         <% end_if %>
      </tbody>
      </table>

Avatar
zenmonkey

Community Member, 528 Posts

31 January 2010 at 10:37am

You're in luck A Tutorial for this was posted this week on ssbits.com :)

http://www.ssbits.com/using-silverstripe-url-parameters-to-display-dataobjects-on-a-page/

Avatar
Harley

Community Member, 153 Posts

1 February 2010 at 1:35am

Zen Monkey you're the man! I'll be honest I've not seen anything like that after scouring the internet. I find SS bits really useful, the tutorials and snippets are very practical.

Thanks again