How to setup if statement for the different page layouts?

Permalink
Hi,

I'm a bit new to Concrete5 (~week). I'm customizing a backend UI for a client using various tools from Concrete5. At first, we were going to use Wordpress, but after hearing about what he wanted to do, I thought C5's default functionality was much more suitable for him.

I'm building the site using the blank 960 grid. I really like working with minimal CSS presets. Unfortunately, it's not set up for a sidebar (the sidebar just a regular div with class="sidebar", see herehttp://blankconcrete5theme.ajdwv.com/)....

I know I can just use PHP to fix things, but I'm not sure what variables to use. Anyone know what the proper variables area? Here's an example of what I'd like to do:


// LEFT SIDEBAR
if ($layout == 'left_sidebar') {
print '<div class="main" class="columns_8"></div>';
print '<div class="sidebar" class="columns_4"></div>';
}

// FULL WIDTH
elseif ($layout == 'full_width') {
print '<div class="main" class="columns_12"></div>';
}

I would appreciate any help.

-R

 
rdesignista replied on at Permalink Reply
Ok, so I actually found the answer quite quickly. The Blank 960 theme assumes you know the ins and outs of C5 already, but after a little searching and deduction, I've figured it out:

- In your theme folder, you will have several .php files. One should be "view.php" and one should be "default.php". If you open them up, you see that these create the basic HTML layout of your sites, depending on what page layout you pick.

- The default theme automatically creates the proper adjustments for your different page layouts, but the Blank 960 does not.

- To create the layout, you add a php file in the default directory, using the "handle" as the php file name. What's the handle? If you go to Dashboard > Page Types, you'll see that the left sidebar's handle is "left_sidebar" (these are the handles I have, they may be different for you). Thus, to create a layout for this, simply create a file named "left_sidebar.php". Just copy what's in default.php into left_sidebar.php. And of course, you can do the same for full width (full.php) or a blog entry (blog_entry.php).

- Now we use the 960 grid's functionality. The 960 grid framework divides the width into 12 columns. You need to assign columns to .main and .sidebar. To do this simply go into whatever layout you're editing and add this class to the same div: "grid_x," where 'x' is the number of columns you want for your width.

Example:

<div class="main grid_8"></div>
<div class="sidebar grid_4"></div>

This will yield a main column that is 8/12 the width of 960px, and a sidebar that is 4/12 the width of 960px. The theme's css takes care of everything else!

P.S. The 1st week of learning Concrete5 is really hard.

-R