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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Customising the CMS /

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

Readmore link problem when list of details


Go to End


1315 Views

Avatar
amarbhanu

Community Member, 57 Posts

25 June 2009 at 7:01pm

aram sir,

i wrote a code but this page $link not work so please suggest me.., al data fetch then show result but when page show with readmore link this link copy with "search" but i can't understand how to process or carry ID and behalf of this ID open related this data, so please sir help me..

mentor.ss

<div class="typography">
<% if Menu(2) %>
<% include SideBar %>
<div id="Content">
<% end_if %>

<% if Level(2) %>
<% include BreadCrumbs %>
<% end_if %>

<h2>$Title</h2>

$Content
<% if Students %>

<h2>$FirstName </h2>test
<p>$Lastname
<% control Students %>

<table border="0" cellpadding="0" cellspacing="0">

<tr>
<td><h3>$EventName</h3>
<p>$Date</p><p></p> <p>$Detail.LimitWordCountXML</p>
<a class="readMoreLink" href="$Link" title="Read more about &quot;{$Title}&quot;">Read more about &quot;{$EventName}&quot;...</a>
</li></td>

</tr>
<% end_control %>

</table>
<% else %>
<p>There is no any student working with this mentor.</p>
<% end_if %>

$Form
$PageComments

<% if Menu(2) %>
</div>
<% end_if %>
</div>

mentor.php

<?php

class Mentor extends Page {

static $db = array(
'EventName' => 'Text',
'Date' => 'Date',
'Detail' => 'Text'
);

static $has_many = array(
'Students' => 'Student'
);

function getCMSFields() {
$fields = parent::getCMSFields();

$fields->addFieldToTab( 'Root.Content.Main', new TextField( 'EventName', 'Event Name' ) );
$fields->addFieldToTab( 'Root.Content.Main', new DateField( 'Date' ) );

$tablefield = new HasManyComplexTableField(
$this,
'Students',
'Student',
array(
'EventName' => 'Event Name',
'Date' => 'Event Date',
'Detail' => 'Detail'
),
'getCMSFields_forPopup'
);
$tablefield->setAddTitle( 'A Student' );

$fields->addFieldToTab( 'Root.Content.Students', $tablefield );

return $fields;
}

function forTemplate() {
$template = 'GSOCPerson';
return $this->renderWith( $template );
}

}

class Mentor_Controller extends Page_Controller {

}

?>