JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
can choose page layouts, edit sidebar, etc
[wfpl-cms.git] / inc / cms.php
index 02dc63e..895c810 100644 (file)
@@ -43,13 +43,24 @@ function cms_display($basename, &$tem) {
 
 function cms_display_content(&$tem /*, 'where clause %", %i', string, int */) {
        $args = array_slice(func_get_args(), 1);
-       $args = array_merge(array('cms_pages', 'id,title,keywords,description,content'), $args);
+       $args = array_merge(array('cms_pages', 'id,title,keywords,description,layout,content,sidebar_content'), $args);
        $row = call_user_func_array('db_get_assoc', $args);
        if($row) {
                $tem->set('$cms_title', $row['title']);
                $tem->set('$meta_keywords', $row['keywords']);
                $tem->set('$meta_description', $row['description']);
                $tem->set('$cms_body', $row['content']);
+               if ($row['layout'] === '' || $row['layout'] === '0') {
+                       $tem->set('$layout_centerer_class', 'full');
+               } else {
+                       $tem->set('$layout_centerer_class', 'with_sidebar');
+                       if ($row['layout'] === '1') {
+                               $tem->set('$layout_sidebar_class', 'plain');
+                       } else {
+                               $tem->set('$layout_sidebar_class', 'bordered');
+                       }
+                       $tem->set('$cms_sidebar', $row['sidebar_content']);
+               }
                return $row['id'];
        }
        return false;