I think that posting my code would help.(?)
----------------------------------------------------------------------------------------------------------------------
class Serie extends DataObject {
static $db = array(
'Name' => 'Varchar',
'Server' => "Enum('Tcamts051,Tcamts052')",
'Folder' => "Enum('series 1,series 2, series3, series 4')",
'Omschrijving' => 'Text'
);
static $has_one = array (
'SerieCover' => 'Image',
'SeriePagina' => 'SeriePagina'
);
static $has_many = array(
'Episodes' => 'Episode'
);
static $searchable_fields = array ('Name');
static $singular_name = 'Serie';
static $plural_name = 'Series';
}
----------------------------------------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------------------------------------
class Episode extends DataObject {
static $db = array(
'Name' => 'Varchar',
'Season' => "Enum('Season 01,Season 02,Season 03,Season 04,Season 05,Season 06,Season 07,Season 08,Season 09,Season 10,Specials')"
);
static $has_one = array(
'MySerie' => 'Serie'
);
}
-------------------------------------------------------------------------------------------------------------------------------------------------
I manage those with Modeladmin
-------------------------------------------------------------------------------------------------------------------------------------------------
class SerieAdmin extends ModelAdmin {
static $managed_models = array(
'Serie',
'Episode',
);
static $url_segment = 'series';
}
-------------------------------------------------------------------------------------------------------------------------------------------------
Then for my SeriePage..
-------------------------------------------------------------------------------------------------------------------------------------------------
class SeriePagina extends Page {
static $db = array ();
static $has_many = array(
'Series' => 'Serie'
);
static $singular_name = 'Serie Pagina';
static $plural_name = 'Serie Paginas';
}
class SeriePagina_Controller extends Page_Controller {
function GetEpisode() {
if($id = Director::urlParam('ID')) {
$afl = DataObject::get_by_id('Episode', $id);
return $this->customise(array('Episode' => $afl))->renderWith(array('EpisodePage', 'Page'));
}
}
}
-----------------------------------------------------------------------------------------------------------------------------
And my Template for listing the Series
-----------------------------------------------------------------------------------------------------------------------------
<div class="typography">
<% if Series %>
<% control Series %>
<table width="757" border="1" align="center">
<tr>
<td width="86"><a href="AND THIS IS THE PROBLEM">$Name</a></td>
<td width="522"> </td>
</tr>
<tr>
<td height="160">$SerieCover.Setwidth(85)</a></td>
<td>$Omschrijving</td>
</tr>
</table>
<% end_control %>
<% else %>
Geen Series
<% end_if %>
$Content
</div>
------------------------------------------------------------------------------------------------------------------------------------------
I did make a EpisodePage.ss
------------------------------------------------------------------------------------------------------------------------------------------
<link href="../../css/typography.css" rel="stylesheet" type="text/css" />
<div class="typography">
<h2>$Name</h2>
<% if Episode %>
<ul>
<% control Episode %>
<li><a href="mms:\\\$MySerie.Server\$MySerie.Folder\$MySerie.Name\$Season\{$Name}.wmv" class="left">$Name</a></li>
<% end_control %>
</ul>
<% else %>
No episodes yet
<% end_if %>
</div>
------------------------------------------------------------------------------------------------------------------------------------
Btw Pigeon, i hope you don't mind but i asked Hamish to look at this also 'cause he handled the same kind of question a while ago.