Hi, I am making a turist site, where TourPages are listed in a TourHolder Page. But also the latest tour is shown on a HomePage. I made this according to the 2nd tutorial.
The HomePage works fine until a TourHolder page is created. After this when previewing the HomePage in a Stage (or Live) mode I recieve the following error: "Error. The website server has not been able to respond to your request." And the same error on site flush. The HomePage URL is unchanged, i.e. "home".
Though the TourHolder and the TourPages are displayed correctly in Stage mode.
I suppose I have done smth wrong with the templates but can't figure it out. Could you, please, check it out?
HomePage.php
<?php
/**
* Defines the HomePage page type
*/
class HomePage extends Page {
static $db = array(
"Information" => "HTMLText",
"News" => "HTMLText"
);
static $has_one = array(
);
function getCMSFields() {
$fields = parent::getCMSFields();
$fields->addFieldToTab("Root.Content.Main", new HTMLEditorField("Information"), "Content");
$fields->addFieldToTab("Root.Content.Main", new HTMLEditorField("News"), "Content");
return $fields;
}
}
class HomePage_Controller extends Page_Controller {
function LatestTour() {
$newtour = DataObject::get_one("TourHolder");
return ($newtour) ? DataObject::get("TourPage", "ParentID = $newtour->ID", "Date DESC", "", 1) : false;
}
}
?>
HomePage.ss fragment:
<div class="leftblock">
<% control LatestTour %>
<h3><span class="new">NEW!</span><a href="$Link" title=""{$Title}"">$Title</a></h3>
<p>$Content.FirstParagraph <a href="$Link" title=""{$Title}""><span class="arrow"> →</span></a></p>
<% end_control %>
</div>