Jump to:

23370 Posts in 18145 Topics by 2864 members

General Questions

SilverStripe Forums » General Questions » HomePage

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

Page: 1
Go to End
Author Topic: 561 Views
  • animasola
    Avatar
    Community Member
    121 Posts

    HomePage Link to this post

    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" 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!

  • animasola
    Avatar
    Community Member
    121 Posts

    Re: HomePage Link to this post

    Oh, I got it working.

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

    561 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.