1260 Posts in 349 Topics by 485 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 1393 Views |
-
$Layout is empty

4 September 2009 at 6:25pm
I am setting up my first Silver Stripe site after doing the tutorials, and the Layouts are not working for me. I have a Page.ss and Layout/Page.ss, and I am using $Layout to include the layout in the main template. When I go to a Page, there is no HTML coming through from the Layout file. I cannot find any differences between the tutorial and my code.
Can anyone help me?
mysite/code/Page.php:
<?php
class Page extends SiteTree {
public static $db = array(
);
public static $has_one = array(
);
}
class Page_Controller extends ContentController {
public function init() {
parent::init();
}
}
?>themes/sunfresh/templates/Page.ss:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><% base_tag %>
<title><% if MetaTitle %>$MetaTitle<% else %>$Title<% end_if %> » Your Site Name</title>
$MetaTags(false)
<link rel="shortcut icon" href="/favicon.ico" />
...</head>
<body><div id="container">
<div id="header">
<div id="topmenu">
<% include Navigation %>
</div>
</div>
<div id="menu_bg">
<div id="menu">
<% include Menu %>
</div>
</div>
<div id="holder">
$Layout
</div><div class="clearfooter"></div>
</div><div id="footer">
<% include Footer %>
</div></body>
</html>themes/sunfresh/templates/Layout/Page.ss:
<div id="content">
$Content
</div>
<div id="submenu">
<% include SubMenu %>
</div>View Source:
...
</div>
<div id="holder">
</div>
<div class="clearfooter"></div>...
-
Re: $Layout is empty

4 September 2009 at 7:31pm
Hi and welcome to SilverStripe
Did you flush the cache of the page by appending ?flush=1 to the URL? This is necessary when you add layout files or includes.
-
Re: $Layout is empty

4 September 2009 at 7:45pm
I put ?flush=1 at the end of the url, and went to the /dev/build/?flush=1 for good measure.
-
Re: $Layout is empty

4 September 2009 at 9:30pm
To no avail? That's really strange. Your code looks fine to me.
Maybe also try to clear the browser cache, although it's unlikely that this is causing the problem...
You did set the theme to 'sunfresh', right?// put this in your mysite/_config.php
SSViewer::set_theme('sunfresh'); -
Re: $Layout is empty

5 September 2009 at 5:56am Last edited: 5 September 2009 6:02am
Yeah, I found it strange too.
I've tried different browsers on different computers, and it definitely is using the 'sunfresh' theme.
The site is located here: http://sunfresh.digitalglyptics.ca
Update:
Here's something I just noticed, the 404 page and Security/login page both work with the Layout.404: http://sunfresh.digitalglyptics.ca/fff/
login: http://sunfresh.digitalglyptics.ca/Security/login -
Re: $Layout is empty

7 September 2009 at 1:00pm
I fixed the problem. I had mistakenly ended a control block in Includes/Menu.ss with <% end_if %> instead of <% end_control %>.
| 1393 Views | ||
|
Page:
1
|
Go to Top |


