Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

General Questions

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

HomePage


Reply

2 Posts   584 Views

Avatar
animasola

4 October 2009 at 3:53pm Community Member, 121 Posts

Hi,

I want a different layout for my hompage so I tried doing what most did when I searched through the forums.

I create a HomePage.php and placed it in mysite/code/:

<?php

class HomePage extends Page {

}
class HomePage_Controller extends Page_Controller {
   function init() {
      parent::init();
   }
}

?>

I then created a HomePage.ss and placed it in themes/blackcandy/templates/Layout/:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" >

<head>
      <% base_tag %>
      <title><% if MetaTitle %>$MetaTitle<% else %>$Title<% end_if %> &raquo; Your Site Name</title>
      $MetaTags(false)
      <link rel="shortcut icon" href="/favicon.ico" />
      
      <% require themedCSS(layout) %>
      <% require themedCSS(typography) %>
      <% require themedCSS(form) %>
      
      <!--[if IE 6]>
         <style type="text/css">
          @import url(themes/blackcandy/css/ie6.css);
         </style>
      <![endif]-->
      
      <!--[if IE 7]>
         <style type="text/css">
          @import url(themes/blackcandy/css/ie7.css);
         </style>
      <![endif]-->
   </head>
<body>
<div id="BgContainer">
   <div id="Header">
      <div id="HeadContainer">
         <h1>Ateneo Department of Political Science</h1>
      </div>
      <div id="Banner">
      </div>
   </div>
   
   <div id="Nav">
      <div id="Navigation">
         <% include Navigation %>
      </div>
   </div>
   
   <div id="Countdown">
      <div id="Clocks">
      </div>
      <div id="CountdownSide">
      </div>
   </div>
   
   <div id="Container">       
       <div class="clear"><!-- --></div>
      <div id="Layout">
       <p>It Works!</p>
      </div>
      
    <div class="clear"><!-- --></div>
   </div>
   <div id="Footer">
      <% include Footer %>
   </div>
</div>

</body>
</html>

But it doesn't work, it still shows the default page generated by SilverStripe even though I removed the $Layout from HomePage.ss and replaced it with a simple p tag showing that it works.

Can anyone help? I'm relatively new to coding in SilverStripe. Thanks! :)

Avatar
animasola

4 October 2009 at 4:06pm Community Member, 121 Posts

Oh, I got it working.

I forgot to build the db and change the pagetype. haha. my bad. Thanks!