I have the following setup. A FacultyPage page type and a Faculty dataobject. A FacultyPage has many Faculty and a Faculty has one Faculty Page. Within the Faculty Page controller I have the following code...
function showfaculty() {
if($id = Director::urlParam('ID')) { // check to see we have been passed an ID
$showfaculty = DataObject::get_by_id("Faculty", $id);
return $this->customise(array('Faculty' => $showfaculty))->renderWith(array('FacultyMember', 'Page'));
}
}
This works fine with a url like mysite.com/facultypage/showfaculty/1
My question is how to get the correct facultypage to print in the link? Because it is within a faculty control loop on the FacultyPage.ss page it won't display the url with the facultypage part, nor can I call something like $URLSegment. Here is the template code...
<% control Faculty %>
<tr class="<% if Even %>even<% else %>odd<% end_if %>">
<td><a href="showfaculty/$ID">$FirstName $LastName</a></td>
<td>$Phone</td>
<td class="last"><a href="mailto:$Email">$Email</a></td>
<% end_control %><!-- end of Faculty control -->
I need this part: <a href="showfaculty/$ID"> to print: mysite.com/facultypage/showfaculty/1 not this: mysite.com/showfaculty/1
Any ideas would be a big help, thanks!