2. The Main Content Page - default.wc
Depending on the layout you choose to implement, default.wc can be full page, one column to the right or left, two columns to the right or left or three columns.
Make use of bootstrap's grid layout to implement the columns. Do not code the content of the columns in this page, instead when needed use sidebar_1.wc and sidebar_2.wc for the content for your columns.
When you have a single column either to the right or to the left, put your content in sidebar_1.wc and you can include this file by using the <%= get_sidebar_1() %>
system function.
Using this technique will make it very easy to, switch or provide, left or right colum layout as the column content won't change and you don't need to recode and maintain it twice.
Change only the column position in your main content page and you are done.
For two columns scenario, use sidebar_2.wc for storing content and you can include this file by using the <%= get_sidebar_2() %>
system function.
Below there is a sample of a three column layout:
<%= get_header() %><!-- get default header: header.wc--> <!-- main content --> <section id="main-content-area" class="clearfix" > <div class="container"> <!-- top content --> <div id="top-content-region" class="clearfix"> <%= get_dynamic_widgets('top-content') %> </div> <section id="main-content-wrap" class="clearfix"> <div class="row-fluid"> <!-- left sidebar 1 --> <div class="span2"> <aside id="left-column-1"> <div id="sidebar-1-region" class="clearfix"> <%= get_sidebar_1() %> <%= get_dynamic_widgets('sidebar-1') %> </div> </aside> </div> <!-- main content --> <div class="span8"> <section id="main-column"> <!-- above dynamic content --> <div id="above-content-region" class="clearfix"> <%= get_dynamic_widgets('above-content') %> </div> <!-- dynamic content --> <div id="dynamic-content-region" class="clearfix"> <%=pclist%> </div> <!-- below dynamic content --> <div id="below-content-region" class="clearfix"> <%= get_dynamic_widgets('above-content') %> </div> </section> </div> <!-- right sidebar 2 --> <div class="span2"> <aside id="right-column-1"> <div id="sidebar-2-region"> <%= get_sidebar_2() %> <%= get_dynamic_widgets('sidebar-2') %> </div> </aside> </div> </div> </section> <!-- bottom content --> <div id="bottom-content-region" class="clearfix"> <%= get_dynamic_widgets('bottom-content') %> </div> </div> </section> <!-- get default footer: footer.wc --> <%= get_footer() %>
Look at this page not as a content page but as a layout descriptor. Make it as modular as possible for maxium flexibility.
The framework provides you with inlcude functions that are similar to PHP, ASP or SSI. To include any page from the template directory you would use
<%= get_page('mypage.wws')%>
system function.
As a guideline, use the ".wc" extension to pages that describe layout and template and use ".wws" for content.
When including a page, the Sophio system will look in three places for its location in the following order:
- The templates subdirectory of the design package you create (app/design/<design-name>/templates/) (read-write, this is where your package is installed)
- The templates subdirectory of the application (app/templates/) (read-only, write if the client gives you access)
- The system template subdirectory ( read-only)
It is recommended that you implement the top-content, above-content, and below-content regions in this file.
You can use any valid html tags for a semantic representation of these areas.
You are required to include a call to the <%= get_dynamic_widgets('area') %>
system function.
This will add future compatibility with Sophio's widget configuration tool yet to be released.
At the end of the page we use the <%= get_footer() %>
to include the footer.wc template page.
Below are variations of page described above:
Two colum layout with a side column on the LEFT:
<%= get_header() %><!-- get default header: header.wc--> <!-- main content --> <section id="main-content-area" class="clearfix" > <div class="container"> <!-- top content --> <div id="top-content-region" class="clearfix"> <%= get_dynamic_widgets('top-content') %> </div> <section id="main-content-wrap" class="clearfix"> <div class="row-fluid"> <!-- left sidebar 1 --> <div class="span3"> <aside id="left-column-1"> <div id="sidebar-1-region" class="clearfix"> <%= get_sidebar_1() %> <%= get_dynamic_widgets('sidebar-1') %> </div> </aside> </div> <!-- main content --> <div class="span9"> <section id="main-column"> <!-- above dynamic content --> <div id="above-content-region" class="clearfix"> <%= get_dynamic_widgets('above-content') %> </div> <!-- dynamic content --> <div id="dynamic-content-region" class="clearfix"> <%=pclist%> </div> <!-- below dynamic content --> <div id="below-content-region" class="clearfix"> <%= get_dynamic_widgets('above-content') %> </div> </section> </div> </div> </section> <!-- bottom content --> <div id="bottom-content-region" class="clearfix"> <%= get_dynamic_widgets('bottom-content') %> </div> </div> </section> <!-- get default footer: footer.wc --> <%= get_footer() %>
Two colum layout with a side column on the RIGHT:
<%= get_header() %><!-- get default header: header.wc--> <!-- main content --> <section id="main-content-area" class="clearfix" > <div class="container"> <!-- top content --> <div id="top-content-region" class="clearfix"> <%= get_dynamic_widgets('top-content') %> </div> <section id="main-content-wrap" class="clearfix"> <div class="row-fluid"> <!-- main content --> <div class="span9"> <section id="main-column"> <!-- above dynamic content --> <div id="above-content-region" class="clearfix"> <%= get_dynamic_widgets('above-content') %> </div> <!-- dynamic content --> <div id="dynamic-content-region" class="clearfix"> <%=pclist%> </div> <!-- below dynamic content --> <div id="below-content-region" class="clearfix"> <%= get_dynamic_widgets('above-content') %> </div> </section> </div> <!-- right sidebar 2 --> <div class="span3"> <aside id="right-column-1"> <div id="sidebar-2-region"> <%= get_sidebar_1() %> <%= get_dynamic_widgets('sidebar-1') %> </div> </aside> </div></div> </section> <!-- bottom content --> <div id="bottom-content-region" class="clearfix"> <%= get_dynamic_widgets('bottom-content') %> </div> </div>
IMPORTANT! Please note that in the above example we are still loading sidebar_1 in the sidebar_2_region position! Sidebar_2 is only used when we have a three column display or we have to display two sidebars. In any other case when we show a single sidebar, sidebar_1 is used regardless if the sidebar is positioned to the left or right of the main content.