How can I add a custom function to my template?
This gives me an error: Parse error: syntax error, unexpected $end
<?php
// PortfolioIndex.php
class PortfolioIndex extends Page {
static $db = array(
'Heading' => 'Text'
);
static $has_one = array(
);
function getCMSFields() {
$fields = parent::getCMSFields();
$fields->addFieldToTab("Root.Content.Content", new TextField('Heading','Heading'));
return $fields;
}
}
class PortfolioIndex_Controller extends Page_Controller {
function CustomStuff () {
return '<h1>CustomStuff</h1>';
}
}
?>
And here is my template (PortfolioIndex.ss) :
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>$MetaTitle</title>
<% base_tag %>
</head>
<body>
<% control CustomStuff %>
</body>
</html>