hey Guys,
i want to create a new pagetype, that loads just the $Content of another page.
so, the new pagetype has a new text DB field "showContent"
<?php
class CreatePopup extends SiteTree {
static $db = array(
'showContent' => 'Text'
);
static $has_one = array(
);
function getCMSFields() {
$fields = parent::getCMSFields();
$fields->addFieldToTab('Root.Content.Main', new TextField('showContent'), 'Content');
return $fields;
}
}
class CreatePopup_Controller extends ContentController {
function init() {
parent::init();
Requirements::themedCSS("layout");
Requirements::themedCSS("typography");
Requirements::themedCSS("form");
}
}
?>
in my "CreatePopup.ss" File i can write
Hello i am loading Content from http://www.yoursite.com/$showContent/
Then there is no error and the Content of "$showContent" is shown.
But now, i want to use this code..
<% control Page($showContent/) %>$Content<% end_control %>
So this PageType shoud show just the $Content of another Page. ("$showContent" contains the URLSegment of the page what should be loaded). But when i use this Variable in Control Page, i get this ERROR:
Parse error: syntax error, unexpected '}' in /tmp/silverstripe-cache-srv-www-vhosts-domain.com-httpdocs/.cache.srv.www.vhosts.domain.com.httpdocs.themes.domain.templates.CreatePopup.ss on line 53
Can someone Help me?
p.s.:
i tried to write a function in CreatePopup.php, but i'm not going on with it.. just many errors..
function showControlContent($showContent) {
$existingCont = DataObject::get_one("SiteTree", "URLSegment = '$showContent'");
if($existingCont) {
$makeControlPageContent = "<% control Page(".$showContent.") %>$Title<% end_control %>";
return $makeControlPageContent;
}
}