Existing Code in the Silverstripe 2.4 template
Header.ss
<% control Objects(QuickLink) %>
<li><a href="$Link" target="_blank">$LinkText</a></li>
<% end_control %>
this no longer works on 3.1. I replaced the control with loop
Can I use a DataObject in a template which has no relation with Page. Like here QuickLink is not having relation with any of the Dataobjects. And it must be displayed in the frontend on all the pages. It works fine in 2.4 version and not working in 3.1.
<% loop Objects(QuickLink) %>
<li><a href="$Link" target="_blank">$LinkText</a></li>
<% end_loop %>
class QuickLink extends DataObject
{
static $db = array(
'Link' => 'Varchar(255)',
'LinkText' => 'Varchar(100)'
);
function getCMSFields()
{
$fields = new FieldList();
$fields->push(new TextField('Link'));
$fields->push(new TextField('LinkText'));
return $fields;
}
}