Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

blogs integrated as a block

  • Loading branch information...
commit 056c027035ef3d3129e7989a41de118c7df46146 1 parent 9489bec
@jordan-wilson authored
Showing with 768 additions and 399 deletions.
  1. +33 −0 app/front/controllers/blocks.controller.php
  2. +0 −84 app/front/controllers/blog.controller.php
  3. +182 −0 app/front/controllers/blogs.controller.php
  4. +4 −6 app/front/controllers/forms.controller.php
  5. +63 −61 app/front/controllers/{page.controller.php → pages.controller.php}
  6. +2 −22 app/front/core/controller.php
  7. +1 −1  app/front/core/router.php
  8. +52 −0 app/front/models/blocks.model.php
  9. +18 −14 app/front/models/{blog.model.php → blogs.model.php}
  10. +93 −0 app/front/models/layouts.model.php
  11. +55 −86 app/front/models/{page.model.php → pages.model.php}
  12. +1 −1  index.php
  13. +10 −0 skins/front/default/blocks.blue.template.php
  14. +10 −0 skins/front/default/blocks.default.template.php
  15. +10 −0 skins/front/default/blocks.green.template.php
  16. +0 −30 skins/front/default/blog.landing.template.php
  17. +0 −20 skins/front/default/blog.view.template.php
  18. +12 −0 skins/front/default/blogs.blog.block.template.php
  19. +10 −0 skins/front/default/blogs.categories.block.template.php
  20. +32 −0 skins/front/default/blogs.landing.template.php
  21. +11 −0 skins/front/default/blogs.recent.block.template.php
  22. +5 −0 skins/front/default/blogs.subscribe.block.template.php
  23. +22 −0 skins/front/default/blogs.view.template.php
  24. +0 −20 skins/front/default/css/blog.css
  25. +43 −0 skins/front/default/css/blogs.css
  26. +93 −0 skins/front/default/css/content.css
  27. +0 −51 skins/front/default/css/style.css
  28. +2 −2 skins/front/default/footer.template.php
  29. +1 −0  skins/front/default/header.template.php
  30. 0  skins/front/default/{layout.blog.template.php → layout.blogs.template.php}
  31. +3 −1 skins/front/default/{page.index.template.php → pages.content.template.php}
View
33 app/front/controllers/blocks.controller.php
@@ -0,0 +1,33 @@
+<?php
+
+class blocks extends controller
+{
+
+ public function get_block( $arg = '' )
+ {
+ if (is_numeric($arg))
+ {
+ // get block info
+ $blocks_model = load_model('blocks');
+ $data = $blocks_model->get_block($arg);
+
+ if ( ! count($data)) return '';
+
+ // the template to use for the block
+ $template = 'blocks.default.template.php';
+ if ($data['skin'] != '')
+ {
+ $skin = 'blocks.' . $data['skin'] . '.template.php';
+ $path = SITE_ROOT . '/skins/' . APP . '/' . $this->registry->skin . '/' . $skin;
+ if (file_exists($path))
+ $template = $skin;
+ }
+
+ // load block
+ return load_view($template, $data);
+ }
+
+ return '';
+ }
+
+}
View
84 app/front/controllers/blog.controller.php
@@ -1,84 +0,0 @@
-<?php
-
-class blog extends controller
-{
-
- public function index( $data = array() )
- {
- if ( ! $this->page) return;
-
- $request = $this->registry->request_args;
-
- // blog landing page
- if (count($request) == 1)
- {
- $this->landing($data);
- return;
- }
- // blog post
- elseif (count($request) == 2)
- {
- $this->view($request[1], $data);
- return;
- }
-
- // show error page
- if (method_exists($this->page, 'error_page'))
- {
- $this->page->error_page();
- }
-
- }
-
-
- private function add_css()
- {
- $css = '/skins/' . APP . '/' . $this->registry->skin . '/css/blog.css';
- $this->registry->add_css_by_url($css);
- }
-
-
- private function landing( $data = array() )
- {
- // get recent blogs
- $blog_model = load_model('blog');
- $data['blogs'] = $blog_model->get_landing();
-
- // add css
- $this->add_css();
-
- // load landing page
- $this->page->content = load_view('blog.landing.template.php', $data);
- }
-
-
- private function view( $url = '', $data = array() )
- {
- // get blog info
- $blog_model = load_model('blog');
- $data['blog'] = $blog_model->get_view($url);
-
- // blog not found
- if ( ! $data['blog'])
- {
- if (method_exists($this->page, 'error_page'))
- {
- $this->page->error_page();
- }
- }
-
- // update meta
- if (method_exists($this->page, 'update_meta'))
- {
- $this->page->update_meta($data['blog']);
- }
-
- // add css
- $this->add_css();
-
- // load blog post
- $this->page->content = load_view('blog.view.template.php', $data);
- }
-
-
-}
View
182 app/front/controllers/blogs.controller.php
@@ -0,0 +1,182 @@
+<?php
+
+class blogs extends controller
+{
+
+ private function add_css()
+ {
+ $css = '/skins/' . APP . '/' . $this->registry->skin . '/css/blogs.css';
+ $this->registry->add_css_by_url($css);
+ }
+
+
+ public function get_block( $arg = '' )
+ {
+ // blog content
+ if ( $arg == 'content' )
+ {
+ $request = $this->registry->request_args;
+
+ // blog landing page
+ if (count($request) == 1)
+ {
+ return $this->index();
+ }
+
+ // blog post
+ elseif (count($request) == 2)
+ {
+ return $this->view( $request[1] );
+ }
+
+ // to many arguments in the url
+ elseif ($this->pages)
+ {
+ if (method_exists($this->pages, 'error_page'))
+ {
+ $this->pages->error_page();
+ }
+ }
+ }
+
+ // individual blog block
+ elseif (is_numeric($arg))
+ {
+ return $this->get_blog_block($arg);
+ }
+
+ // subscribe block
+ elseif ($arg == 'subscribe.block')
+ {
+ return $this->get_subscribe_block();
+ }
+
+ // recent blog post block
+ elseif ($arg == 'recent.block')
+ {
+ return $this->get_recent_block();
+ }
+
+ // blog categories block
+ elseif ($arg == 'categories.block')
+ {
+ return $this->get_categories_block();
+ }
+
+ return '';
+ }
+
+
+ // blogs landing page
+ public function index()
+ {
+ if ( ! $this->pages) return;
+
+ // get page data
+ $data = $this->pages->data;
+
+ // get recent blogs
+ $blogs_model = load_model('blogs');
+ $data['blogs'] = $blogs_model->get_landing();
+
+ // add css
+ $this->add_css();
+
+ // load landing page
+ return load_view('blogs.landing.template.php', $data);
+ }
+
+
+ // individual blog post
+ public function view( $url = '' )
+ {
+ if ( ! $this->pages) return;
+
+ // get page data
+ $data = $this->pages->data;
+
+ // clear default page content
+ $this->registry->page_content = '';
+
+ // get blog info
+ $blogs_model = load_model('blogs');
+ $data['blog'] = $blogs_model->get_view($url);
+
+ // if blog not found
+ if ( ! $data['blog'])
+ {
+ if (method_exists($this->pages, 'error_page'))
+ {
+ $this->pages->error_page();
+ }
+ }
+
+ // update meta
+ if (method_exists($this->pages, 'update_meta'))
+ {
+ $this->pages->update_meta($data['blog']);
+ }
+
+ // add css
+ $this->add_css();
+
+ // load blog post
+ return load_view('blogs.view.template.php', $data);
+ }
+
+
+ // individual blog block
+ private function get_blog_block( $id = 0 )
+ {
+ if ( ! $this->registry->modules['blogs']) return '';
+
+ // get blog info
+ $blogs_model = load_model('blogs');
+ $data['blog'] = $blogs_model->get_blog($id);
+ $data['link'] = '/' . $this->registry->modules['blogs'] . '/';
+
+ // if blog not found
+ if ( ! $data['blog']) return '';
+
+ // add css
+ $this->add_css();
+
+ // load blog post
+ return load_view('blogs.blog.block.template.php', $data);
+ }
+
+
+ // subscribe block
+ private function get_subscribe_block()
+ {
+ if ( ! $this->registry->modules['blogs']) return '';
+ $data['link'] = '/' . $this->registry->modules['blogs'] . '/';
+
+ // load blog subscribe block
+ return load_view('blogs.subscribe.block.template.php', $data);
+ }
+
+
+ // categories block
+ private function get_categories_block()
+ {
+ if ( ! $this->registry->modules['blogs']) return '';
+ $data['link'] = '/' . $this->registry->modules['blogs'] . '/';
+
+ // load blog categories block
+ return load_view('blogs.categories.block.template.php', $data);
+ }
+
+
+ // recent blog post block
+ private function get_recent_block()
+ {
+ if ( ! $this->registry->modules['blogs']) return '';
+ $data['link'] = '/' . $this->registry->modules['blogs'] . '/';
+
+ // load recent blog post block
+ return load_view('blogs.recent.block.template.php', $data);
+ }
+
+
+}
View
10 app/front/controllers/forms.controller.php
@@ -9,18 +9,15 @@ class forms extends controller
public function get_block( $id = 0 )
{
// check if form is unique
- if (in_array($id, $this->forms))
- return '<p><strong>!!! Form:' . $id . ' already in use on the page. Can only have a single instance of any form on a page.</strong></p>';
+ if (in_array($id, $this->forms)) return '<p>FORM ' . $id . ' IS ALREADY IN USE ON THIS PAGE. YOU CANNOT HAVE MULTIPLE INSTANCES OF A FORM ON A SINGLE PAGE AT ONE TIME.</p>';
$this->forms[] = $id;
-
+ // get the page url
$request = $this->registry->request_args;
if ( ! count($request)) return '';
-
- // the page url
$url = $request[0];
- // check if submitted
+ // check if this form has been submitted
// url would look like this: www.site.com/page/5/submit
$this->submitted = false;
$action = count($request) > 2 ? array_pop($request) : false;
@@ -98,6 +95,7 @@ public function build_form( $id = 0, $url = '', $validate = false )
$html .= $form['content'];
$html .= '</div>';
}
+
// else, return the form
else
{
View
124 app/front/controllers/page.controller.php → app/front/controllers/pages.controller.php
@@ -1,75 +1,52 @@
<?php
-class page extends controller
+class pages extends controller
{
public $data = array();
public function index()
{
- // get page url
- $url = count($this->registry->request_args) ? $this->registry->request_args[0] : 'index';
+ // get the urls of all the pages with modules
+ $this->get_module_urls();
+ // get page url
+ $url = $this->registry->request_args[0];
// get page info
- $page_model = load_model('page');
- $this->data = $page_model->get_page($url);
-
+ $pages_model = load_model('pages');
+ $this->data = $pages_model->get_page($url);
// if page not found
if ( ! count($this->data))
$this->error_page();
-
// update page meta
$this->update_meta($this->data);
+ // update default page content
+ $this->update_page_content();
- // if page is using a module
- if (trim($this->data['module']))
- {
- $module = load_controller($this->data['module']);
- if ($module)
- {
- if (method_exists($module, 'index'))
- {
- $module->index($this->data);
- //return;
- }
- }
- }
-
-
- // if page has a form attached
- /*
- if (trim($this->data['form_id']))
- {
- $forms = load_controller('forms');
- if ($forms)
- {
- if (method_exists($forms, 'index'))
- {
- $this->data = $forms->index($this->data);
- }
- }
- }
- */
-
-
- // load default page view
- if ( ! $this->content)
- $this->content = load_view('page.index.template.php', $this->data);
-
-
- // update layout blocks
+ // update page layout
$this->process_layouts();
-
- // display main template
+ // display layout template
$this->display();
}
+ private function get_module_urls()
+ {
+ // match the layout template name with the page that is using it
+ // the "layout.blogs.template.php" is being used by the "blog" page
+ // since there is no actual database right now i can't really build this function
+ // it'll store all the urls in the registry so anything can access them
+ $arr = array();
+ $arr['blogs'] = 'blog';
+ $this->registry->modules = $arr;
+ }
+
+
// update meta tags
public function update_meta( $data = array() )
{
@@ -89,47 +66,61 @@ public function update_meta( $data = array() )
public function error_page()
{
// get error page info
- $page_model = load_model('page');
- $data = $page_model->get_page('error');
+ $pages_model = load_model('pages');
+ $this->data = $pages_model->get_page('error');
// if error page not found
- if ( ! count($data))
+ if ( ! count($this->data))
error_page();
// update page meta
- $this->update_meta($data);
+ $this->update_meta($this->data);
+
+ // update default page content
+ $this->update_page_content();
+
+ // update page layout
+ $this->process_layouts();
// display error page
header('HTTP/1.1 404 Not Found');
- $this->content = load_view('page.index.template.php', $data);
$this->display();
exit();
}
+ // load blocks into each cell of layout
public function process_layouts()
{
- $layout = $this->data['layout'];
+ // get layout data
+ $layouts_model = load_model('layouts');
+ $layout = $layouts_model->get_layout($this->data['layout']);
- // load layout
+ // if there is layout data
+ //$layout = $this->data['layout'];
if (count($layout))
{
// load layout template
- $template = $layout['template'];
- $path = SITE_ROOT . '/skins/' . APP . '/' . $this->registry->skin . '/' . $template;
- if (file_exists($path))
- $this->main_template = $template;
+ if ($layout['template'] != '')
+ {
+ $template = 'layout.' . $layout['template'] . '.template.php';
+ $path = SITE_ROOT . '/skins/' . APP . '/' . $this->registry->skin . '/' . $template;
+ if (file_exists($path))
+ $this->main_template = $template;
+ }
- // replace modular blocks with actual content
+ // load block content into each cell of the layout
foreach($layout['cells'] as $i => $cell)
{
foreach($cell as $j => $block)
{
+ $html = '';
- // if page content
+ // if regular page content
if ($block == '[content]')
{
- $layout['cells'][$i][$j] = $this->content;
+ //$html = $this->get_content('content');
+ $html = $this->registry->page_content;
}
// else, try and look for modular content
@@ -146,17 +137,28 @@ public function process_layouts()
{
if (method_exists($controller, 'get_block'))
{
- $layout['cells'][$i][$j] = $controller->get_block($matches[2]);
+ $html = $controller->get_block($matches[2]);
}
}
}
}
+ // update cell content
+ $layout['cells'][$i][$j] = $html;
}
}
}
+ // update controller layout
$this->layout = $layout;
}
+
+ // set the page content
+ // some controllers will need to override page content
+ private function update_page_content( $arg = '' )
+ {
+ $this->registry->page_content = load_view('pages.content.template.php', $this->data);
+ }
+
}
View
24 app/front/core/controller.php
@@ -3,42 +3,23 @@
class controller
{
- protected $content;
protected $layout;
public function __construct()
{
- // GET LOADED CLASSES AND ASSIGN THEM TO THIS OBJECT
+ // get loaded classes and assign them to this object
$_classes = is_loaded();
foreach ($_classes as $class)
{
$this->$class = _load_class($class, '');
}
- // SET DEFAULT MAIN TEMPLATE
+ // set default main template
$this->main_template = DEFAULT_MAIN_TEMPLATE;
}
public function display()
{
- // VIEW HASN'T BEEN ASSIGNED YET
- /*
- if ( ! isset($this->content))
- {
- exit ('Content not loaded');
- }
-
- // OUTPUT CONTENTS OF VIEW
- else
- {
- $data = array(
- 'content' => $this->content,
- 'layout' => $this->layout
- );
- echo load_view($this->main_template, $data);
- }
- */
-
if ( ! isset($this->layout))
{
exit ('Layout not yet initialized');
@@ -48,6 +29,5 @@ public function display()
$data = array('layout' => $this->layout);
echo load_view($this->main_template, $data);
}
-
}
}
View
2  app/front/core/router.php
@@ -32,7 +32,7 @@ private function _parse_url()
$_args[] = $request_parts[$i];
}
}
- $this->registry->request_args = $_args;
+ $this->registry->request_args = count($_args) ? $_args : array('index');
}
View
52 app/front/models/blocks.model.php
@@ -0,0 +1,52 @@
+<?php
+
+class blocks_model extends model
+{
+
+ public function get_block( $id = 0 )
+ {
+ $arr = array();
+
+ switch($id)
+ {
+ case 1:
+ $arr['skin'] = 'green';
+ $arr['title'] = 'Block 1';
+ $arr['content'] = '<p>Sed posuere consectetur est at lobortis. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus.</p><p>Vestibulum id ligula porta felis euismod semper. Donec id elit non mi porta gravida at eget metus.</p>';
+ break;
+
+ case 2:
+ $arr['skin'] = 'blue';
+ $arr['title'] = 'Block 2';
+ $arr['content'] = '<p>Sed posuere consectetur est at lobortis. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh.</p>';
+ break;
+
+ case 3:
+ $arr['skin'] = '';
+ $arr['title'] = 'Block 3';
+ $arr['content'] = '<p>Ut fermentum massa justo sit amet risus. Vestibulum id ligula porta felis euismod semper. Donec id elit non mi porta gravida at eget metus.</p>';
+ break;
+
+ case 4:
+ $arr['skin'] = '';
+ $arr['title'] = 'Block 4';
+ $arr['content'] = '<p>Sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.</p>';
+ break;
+
+ case 5:
+ $arr['skin'] = '';
+ $arr['title'] = 'Block 5';
+ $arr['content'] = '<p>Donec id elit non mi porta gravida at eget metus. Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor.</p>';
+ break;
+
+ case 6:
+ $arr['skin'] = '';
+ $arr['title'] = 'Block 6';
+ $arr['content'] = '<p>Donec id elit non mi porta gravida at eget metus. Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor.</p>';
+ break;
+ }
+
+ return $arr;
+ }
+
+}
View
32 app/front/models/blog.model.php → app/front/models/blogs.model.php
@@ -1,15 +1,15 @@
<?php
-class blog_model extends model
+class blogs_model extends model
{
public function get_landing()
{
$arr = array();
- $arr[] = $this->blogs(4);
- $arr[] = $this->blogs(3);
- $arr[] = $this->blogs(2);
- $arr[] = $this->blogs(1);
+ $arr[] = $this->get_blog(4);
+ $arr[] = $this->get_blog(3);
+ $arr[] = $this->get_blog(2);
+ $arr[] = $this->get_blog(1);
return $arr;
}
@@ -19,16 +19,16 @@ public function get_view( $url = '' )
switch( $url )
{
case 'blog1':
- return $this->blogs(1);
+ return $this->get_blog(1);
break;
case 'blog2':
- return $this->blogs(2);
+ return $this->get_blog(2);
break;
case 'blog3':
- return $this->blogs(3);
+ return $this->get_blog(3);
break;
case 'blog4':
- return $this->blogs(4);
+ return $this->get_blog(4);
break;
}
@@ -36,7 +36,7 @@ public function get_view( $url = '' )
}
- public function blogs( $id = 0 )
+ public function get_blog( $id = 0 )
{
$arr = array();
@@ -47,7 +47,8 @@ public function blogs( $id = 0 )
'content' => '<p>Ut fermentum massa justo sit amet risus. Vestibulum id ligula porta felis euismod semper. Donec id elit non mi porta gravida at eget metus.</p>',
'meta_title' => 'Blog :: Blog 1',
'meta_keywords' => '',
- 'meta_description' => ''
+ 'meta_description' => '',
+ 'layout' => 6
);
$arr[2] = array(
@@ -57,7 +58,8 @@ public function blogs( $id = 0 )
'content' => '<p>Donec id elit non mi porta gravida at eget metus. Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor.</p>',
'meta_title' => 'Blog 2',
'meta_keywords' => '',
- 'meta_description' => ''
+ 'meta_description' => '',
+ 'layout' => 6
);
$arr[3] = array(
@@ -67,7 +69,8 @@ public function blogs( $id = 0 )
'content' => '<p>Sed posuere consectetur est at lobortis. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh.</p>',
'meta_title' => 'Blog 3',
'meta_keywords' => '',
- 'meta_description' => ''
+ 'meta_description' => '',
+ 'layout' => 6
);
$arr[4] = array(
@@ -77,7 +80,8 @@ public function blogs( $id = 0 )
'content' => '<p>Sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.</p>',
'meta_title' => 'Blog 4',
'meta_keywords' => '',
- 'meta_description' => ''
+ 'meta_description' => '',
+ 'layout' => 6
);
if ( $arr[$id] )
View
93 app/front/models/layouts.model.php
@@ -0,0 +1,93 @@
+<?php
+
+class layouts_model extends model
+{
+
+ public function get_layout( $id = 0 )
+ {
+ $arr = array();
+
+ switch($id)
+ {
+ case 1: // home
+ $arr = array(
+ 'template' => '',
+ 'cells' => array(
+ 1 => array('[content]'),
+ 2 => array('[blocks:6]'),
+ 3 => array('[blocks:2]'),
+ 4 => array('[blogs:4]'),
+ 5 => array('[forms:2]'),
+ 6 => array('[blogs:recent.block]')
+ )
+ );
+ break;
+
+ case 2: // about
+ $arr = array(
+ 'template' => '',
+ 'cells' => array(
+ 1 => array('[content]'),
+ 2 => array('[blocks:1]', '[blocks:2]'),
+ 3 => array('[blocks:2]'),
+ 4 => array('[blocks:3]'),
+ 5 => array('[blocks:4]'),
+ 6 => array('[blocks:5]')
+ )
+ );
+ break;
+
+ case 3: // blog
+ $arr = array(
+ 'template' => 'blogs',
+ 'cells' => array(
+ 1 => array('[content]','[blogs:content]'),
+ 2 => array('[blocks:1]','[blogs:subscribe.block]','[blocks:3]','[blogs:categories.block]','[blogs:recent.block]')
+ )
+ );
+ break;
+
+ case 4: // contact
+ $arr = array(
+ 'template' => '',
+ 'cells' => array(
+ 1 => array('[content]','[forms:1]'),
+ 2 => array('[blocks:6]','[forms:2]'),
+ 3 => array(),
+ 4 => array(),
+ 5 => array('[blocks:3]'),
+ 6 => array('[forms:2]')
+ )
+ );
+ break;
+
+ case 5: // error
+ $arr = array(
+ 'template' => '',
+ 'cells' => array(
+ 1 => array('[content]'),
+ 2 => array('[blocks:6]'),
+ 3 => array('[blocks:1]'),
+ 4 => array('[blocks:2]'),
+ 5 => array('[blocks:3]'),
+ 6 => array('[forms:2]')
+ )
+ );
+ break;
+
+ case 6: // blogs > blog 1, 2, 3, 4
+ $arr = array(
+ 'template' => 'blogs',
+ 'cells' => array(
+ 1 => array('[blogs:content]'),
+ 2 => array('[blogs:subscribe.block]','[blogs:categories.block]','[blogs:recent.block]')
+ )
+ );
+ break;
+
+ }
+
+ return $arr;
+ }
+
+}
View
141 app/front/models/page.model.php → app/front/models/pages.model.php
@@ -1,6 +1,6 @@
<?php
-class page_model extends model
+class pages_model extends model
{
public function get_page( $url = '' )
@@ -12,180 +12,149 @@ public function get_page( $url = '' )
case 'index':
$arr['id'] = 1;
$arr['url'] = 'index';
- $arr['module'] = '';
$arr['content'] = '<h2>Welcome</h2><p>Sed posuere consectetur est at lobortis. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Vestibulum id ligula porta felis euismod semper. Donec id elit non mi porta gravida at eget metus.</p><p>Donec id elit non mi porta gravida at eget metus. Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.</p>';
$arr['meta_title'] = 'Home';
$arr['meta_keywords'] = 'sed, posuere, consectetur est, at lobortis';
$arr['meta_description'] = 'Sed posuere consectetur est at lobortis. Fusce dapibus tellus ac cursus.';
- $arr['layout'] = $this->get_layout(1);
+ //$arr['layout'] = $this->get_layout(1);
+ $arr['layout'] = 1;
break;
case 'error':
$arr['id'] = 2;
$arr['url'] = 'error';
- $arr['module'] = '';
$arr['content'] = '<h2>Page Not Found</h2><p>The page you were looking for was not found.</p>';
$arr['meta_title'] = 'Page not found';
$arr['meta_keywords'] = '';
$arr['meta_description'] = '';
- $arr['layout'] = $this->get_layout(1);
+ //$arr['layout'] = $this->get_layout(5);
+ $arr['layout'] = 5;
break;
case 'about':
$arr['id'] = 3;
$arr['url'] = 'about';
- $arr['module'] = '';
$arr['content'] = '<h2>About Us</h2><p>Praesent sagittis lacus in elementum sodales lacus justo porttitor lacus vel dictum nisi dui nec turpis. Etiam at nisl nisl, sed porttitor dui. Proin eu laoreet mauris. Proin et massa et nulla pellentesque tempus et sed ligula. Ut congue feugiat enim.</p>';
$arr['meta_title'] = 'About Us';
$arr['meta_keywords'] = '';
$arr['meta_description'] = 'Praesent sagittis lacus in elementum sodales lacus justo porttitor.';
- $arr['layout'] = $this->get_layout(2);
+ //$arr['layout'] = $this->get_layout(2);
+ $arr['layout'] = 2;
break;
case 'blog':
$arr['id'] = 4;
$arr['url'] = 'blog';
- $arr['module'] = 'blog';
$arr['content'] = '<h2>Blog</h2><p>Sed posuere consectetur est at lobortis. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Vestibulum id ligula porta felis euismod semper. Donec id elit non mi porta gravida at eget metus.</p>';
$arr['meta_title'] = 'Blog';
$arr['meta_keywords'] = '';
$arr['meta_description'] = '';
- $arr['layout'] = $this->get_layout(3);
+ //$arr['layout'] = $this->get_layout(3);
+ $arr['layout'] = 3;
break;
case 'contact':
$arr['id'] = 5;
$arr['url'] = 'contact';
- $arr['module'] = '';
$arr['content'] = '<h2>Contact Us</h2><p>Etiam at nisl nisl sed porttitor dui. Proin eu laoreet mauris. Proin et massa et nulla pellentesque tempus et sed ligula. Ut congue feugiat enim.</p>';
$arr['meta_title'] = 'Contact Us';
$arr['meta_keywords'] = '';
$arr['meta_description'] = '';
- $arr['layout'] = $this->get_layout(4);
+ //$arr['layout'] = $this->get_layout(4);
+ $arr['layout'] = 4;
break;
}
return $arr;
}
-
+ /*
public function get_layout( $id = 0 )
{
$arr = array();
switch($id)
{
- case 1:
+ case 1: // home
$arr = array(
- 'template' => 'layout.main.template.php',
+ 'template' => '',
'cells' => array(
1 => array('[content]'),
- 2 => array($this->get_block(6)),
- 3 => array(),
- 4 => array(),
- 5 => array(),
- 6 => array()
+ 2 => array('[blocks:6]'),
+ 3 => array('[blocks:2]'),
+ 4 => array('[blogs:4]'),
+ 5 => array('[forms:2]'),
+ 6 => array('[blogs:recent.block]')
)
);
break;
case 2: // about
$arr = array(
- 'template' => 'layout.main.template.php',
+ 'template' => '',
'cells' => array(
1 => array('[content]'),
- 2 => array(
- $this->get_block(1),
- $this->get_block(2)
- ),
- 3 => array($this->get_block(2)),
- 4 => array($this->get_block(3)),
- 5 => array($this->get_block(4)),
- 6 => array($this->get_block(5))
+ 2 => array('[blocks:1]', '[blocks:2]'),
+ 3 => array('[blocks:2]'),
+ 4 => array('[blocks:3]'),
+ 5 => array('[blocks:4]'),
+ 6 => array('[blocks:5]')
)
);
break;
case 3: // blog
$arr = array(
- 'template' => 'layout.blog.template.php',
+ 'template' => 'blogs',
'cells' => array(
- 1 => array('[content]'),
- 2 => array(
- $this->get_block(1),
- $this->get_block(7),
- $this->get_block(3),
- $this->get_block(8),
- $this->get_block(9)
- )
+ 1 => array('[content]','[blogs:content]'),
+ 2 => array('[blocks:1]','[blogs:subscribe.block]','[blocks:3]','[blogs:categories.block]','[blogs:recent.block]')
)
);
break;
case 4: // contact
$arr = array(
- 'template' => 'layout.main.template.php',
+ 'template' => '',
'cells' => array(
- 1 => array('[content]', '[forms:1]'),
- 2 => array($this->get_block(6), '[forms:2]'),
+ 1 => array('[content]','[forms:1]'),
+ 2 => array('[blocks:6]','[forms:2]'),
3 => array(),
4 => array(),
- 5 => array($this->get_block(3)),
+ 5 => array('[blocks:3]'),
6 => array('[forms:2]')
)
);
break;
-
- }
-
- return $arr;
- }
-
-
- public function get_block( $id = 0 )
- {
- $str = '';
-
- switch($id)
- {
- case 1:
- $str = '<h3>Block 1</h3><p>Sed posuere consectetur est at lobortis. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus.</p><p>Vestibulum id ligula porta felis euismod semper. Donec id elit non mi porta gravida at eget metus.</p>';
- break;
-
- case 2:
- $str = '<h3>Block 2</h3><p>Sed posuere consectetur est at lobortis. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh.</p>';
- break;
-
- case 3:
- $str = '<h3>Block 3</h3><p>Ut fermentum massa justo sit amet risus. Vestibulum id ligula porta felis euismod semper. Donec id elit non mi porta gravida at eget metus.</p>';
- break;
-
- case 4:
- $str = '<h3>Block 4</h3><p>Sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.</p>';
- break;
-
- case 5:
- $str = '<h3>Block 5</h3><p>Donec id elit non mi porta gravida at eget metus. Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor.</p>';
- break;
-
- case 6:
- $str = '<h3>Block 6</h3><p>Donec id elit non mi porta gravida at eget metus. Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor.</p>';
- break;
-
- case 7:
- $str = '<h3>RSS SUBSCRIBE</h3>';
+
+ case 5: // error
+ $arr = array(
+ 'template' => '',
+ 'cells' => array(
+ 1 => array('[content]'),
+ 2 => array('[blocks:6]'),
+ 3 => array('[blocks:1]'),
+ 4 => array('[blocks:2]'),
+ 5 => array('[blocks:3]'),
+ 6 => array('[forms:2]')
+ )
+ );
break;
- case 8:
- $str = '<h3>Categories Block</h3><ul><li>Donec</li><li>Elit non</li><li>Mi porta gravida</li></ul>';
+ case 6: // blogs > blog 1
+ $arr = array(
+ 'template' => 'blogs',
+ 'cells' => array(
+ 1 => array('[content]','[blogs:content]'),
+ 2 => array('[blogs:subscribe.block]','[blogs:categories.block]','[blogs:recent.block]')
+ )
+ );
break;
- case 9:
- $str = '<h3>Recent Blogs</h3><ul><li>Donec id elit non mi</li><li>Porta gravida at eget metus</li><li>Vivamus sagittis lacus vel augue laoreet rutrum</li><li>At eget metus</li></ul>';
- break;
}
- return $str;
+ return $arr;
}
+ */
}
View
2  index.php
@@ -7,7 +7,7 @@
define('SITE_ROOT', dirname(__FILE__));
define('APP', 'front');
define('URL_BASE', '/');
-define('DEFAULT_CONTROLLER', 'page');
+define('DEFAULT_CONTROLLER', 'pages');
define('DEFAULT_SKIN', 'default');
define('ERROR_CONTROLLER', 'error');
define('DEFAULT_MAIN_TEMPLATE', 'layout.main.template.php');
View
10 skins/front/default/blocks.blue.template.php
@@ -0,0 +1,10 @@
+
+ <?php if ($content != '') : ?>
+ <div class="block_blue">
+ <?php if ($title != '') : ?>
+ <h3><?= $title; ?></h3>
+ <?php endif; ?>
+ <?= $content; ?>
+ </div>
+ <?php endif; ?>
+
View
10 skins/front/default/blocks.default.template.php
@@ -0,0 +1,10 @@
+
+ <?php if ($content != '') : ?>
+ <div class="block">
+ <?php if ($title != '') : ?>
+ <h3><?= $title; ?></h3>
+ <?php endif; ?>
+ <?= $content; ?>
+ </div>
+ <?php endif; ?>
+
View
10 skins/front/default/blocks.green.template.php
@@ -0,0 +1,10 @@
+
+ <?php if ($content != '') : ?>
+ <div class="block_green">
+ <?php if ($title != '') : ?>
+ <h3><?= $title; ?></h3>
+ <?php endif; ?>
+ <?= $content; ?>
+ </div>
+ <?php endif; ?>
+
View
30 skins/front/default/blog.landing.template.php
@@ -1,30 +0,0 @@
-
- <?php if ( count($blogs) ) : ?>
-
- <?php foreach( $blogs AS $idx => $blog ) : ?>
-
- <div class="blog_post">
-
- <div class="blog_name">
- <h2><?= $blog['name']; ?></h2>
- </div>
-
- <div class="blog_date">
- <?= date('M d, Y', $blog['date']); ?>
- </div>
-
- <div class="blog_content">
- <?= $blog['content']; ?>
- </div>
-
- <div class="blog_link">
- <a href="<?= $url . '/' . $blog['url']; ?>">read more</a>
- </div>
- </div>
-
- <?php endforeach; ?>
-
- <?php else: ?>
- <p>No blogs have been posted yet.</p>
- <?php endif; ?>
-
View
20 skins/front/default/blog.view.template.php
@@ -1,20 +0,0 @@
-
- <?php if ( count($blog) ) : ?>
-
- <div class="blog_post">
-
- <div class="blog_name">
- <h2><?= $blog['name']; ?></h2>
- </div>
-
- <div class="blog_date">
- <?= date('M d, Y', $blog['date']); ?>
- </div>
-
- <div class="blog_content">
- <?= $blog['content']; ?>
- </div>
- </div>
-
- <?php endif; ?>
-
View
12 skins/front/default/blogs.blog.block.template.php
@@ -0,0 +1,12 @@
+
+ <?php if ( count($blog) ) : ?>
+
+ <div class="blogs_blog_block">
+ <h3><?= $blog['name']; ?></h3>
+ <p><?= date('M d, Y', $blog['date']); ?></p>
+ <p><?= substr(strip_tags($blog['content']), 0, 100); ?>...</p>
+ <p><a href="<?= $link . $blog['url']; ?>">Read on</a></p>
+ </div>
+
+ <?php endif; ?>
+
View
10 skins/front/default/blogs.categories.block.template.php
@@ -0,0 +1,10 @@
+
+ <div class="blogs_categories_block">
+ <h3>Categories Block</h3>
+ <ul>
+ <li>Donec</li>
+ <li>Elit non</li>
+ <li>Mi porta gravida</li>
+ </ul>
+ </div>
+
View
32 skins/front/default/blogs.landing.template.php
@@ -0,0 +1,32 @@
+
+ <?php if ( count($blogs) ) : ?>
+
+ <div class="blogs_landing">
+ <?php foreach( $blogs AS $idx => $blog ) : ?>
+
+ <div class="blogs_post">
+
+ <div class="blogs_post_name">
+ <h2><?= $blog['name']; ?></h2>
+ </div>
+
+ <div class="blogs_post_date">
+ <?= date('M d, Y', $blog['date']); ?>
+ </div>
+
+ <div class="blogs_post_content">
+ <?= $blog['content']; ?>
+ </div>
+
+ <div class="blogs_post_link">
+ <a href="<?= $url . '/' . $blog['url']; ?>">read more</a>
+ </div>
+ </div>
+
+ <?php endforeach; ?>
+ </div>
+
+ <?php else: ?>
+ <p>No blogs have been posted yet.</p>
+ <?php endif; ?>
+
View
11 skins/front/default/blogs.recent.block.template.php
@@ -0,0 +1,11 @@
+
+ <div class="blogs_recent_block">
+ <h3>Recent Blogs</h3>
+ <ul>
+ <li><a href="<?= $link; ?>blog4">Donec id elit non mi</a></li>
+ <li><a href="<?= $link; ?>blog3">Porta gravida at eget metus</a></li>
+ <li><a href="<?= $link; ?>blog2">Vivamus sagittis lacus vel augue laoreet rutrum</a></li>
+ <li><a href="<?= $link; ?>blog1">At eget metus</a></li>
+ </ul>
+ </div>
+
View
5 skins/front/default/blogs.subscribe.block.template.php
@@ -0,0 +1,5 @@
+
+ <div class="blogs_subscribe_block">
+ <h3><a href="<?= $link; ?>rss">RSS SUBSCRIBE</a></h3>
+ </div>
+
View
22 skins/front/default/blogs.view.template.php
@@ -0,0 +1,22 @@
+
+ <?php if ( count($blog) ) : ?>
+
+ <div class="blogs_view">
+ <div class="blogs_post">
+
+ <div class="blogs_post_name">
+ <h2><?= $blog['name']; ?></h2>
+ </div>
+
+ <div class="blogs_post_date">
+ <?= date('M d, Y', $blog['date']); ?>
+ </div>
+
+ <div class="blogs_post_content">
+ <?= $blog['content']; ?>
+ </div>
+ </div>
+ </div>
+
+ <?php endif; ?>
+
View
20 skins/front/default/css/blog.css
@@ -1,20 +0,0 @@
-
-
-.blog_post {
- margin-bottom: 20px;
-}
-
-.blog_date {
- margin-bottom: 5px;
- font-size: 1.1em;
-}
-
-.blog_name {}
-.blog_name h2 {}
-
-.blog_content {
- margin-bottom: 10px;
-}
-
-.blog_link {}
-
View
43 skins/front/default/css/blogs.css
@@ -0,0 +1,43 @@
+
+
+/* blogs landing page */
+.blogs_landing {}
+.blogs_landing .blogs_post {
+ margin-bottom: 20px;
+}
+.blogs_landing .blogs_post_name {}
+.blogs_landing .blog_post_name h2 {}
+.blogs_landing .blogs_post_date {
+ margin-bottom: 5px;
+ font-size: 1.1em;
+}
+.blogs_landing .blogs_post_content {
+ margin-bottom: 10px;
+}
+.blogs_landing .blogs_post_link {}
+
+
+/* individual blog post */
+.blogs_view {}
+.blogs_view .blogs_post {}
+.blogs_view .blogs_post_name {}
+.blogs_view .blog_post_name h2 {}
+.blogs_view .blogs_post_date {
+ margin-bottom: 5px;
+ font-size: 1.1em;
+}
+.blogs_view .blogs_post_content {}
+
+
+
+/* blogs blocks */
+.blogs_subscribe_block {
+ margin-bottom: 20px;
+}
+.blogs_categories_block {
+ margin-bottom: 20px;
+}
+.blogs_recent_block {
+ margin-bottom: 20px;
+}
+
View
93 skins/front/default/css/content.css
@@ -0,0 +1,93 @@
+
+
+/****** BASICS ******/
+body {
+ color: #292929;
+ font-size: 13px;
+ line-height: 1.3;
+ font-family: Arial, sans-serif;
+}
+
+a {
+ color: #0066cc;
+ cursor: pointer;
+ text-decoration: none;
+}
+a:visited {
+ color: #0066cc;
+}
+a:hover {
+ color: #0066cc;
+ text-decoration: none;
+}
+
+p, h1, h2, h3, h4, h5, h6, ul, ol, table {
+ margin: 0 0 1em 0;
+}
+
+h1, .h1 {
+ margin-bottom: 0.5em;
+ font-size: 1.61538em; /* 21px / 13px */
+ font-weight: bold;
+}
+h2, .h2 {
+ margin-bottom: 0.5em;
+ font-size: 1.53846em; /* 20px / 13px */
+ font-weight: bold;
+}
+h3, .h3 {
+ margin-bottom: 0.5em;
+ font-size: 1.15385em; /* 15px / 13px */
+ font-weight: bold;
+}
+h4, .h4 {
+ font-size: 1em; /* 13px / 13px */
+ font-weight: bold;
+}
+h5, .h5 {
+ margin-bottom: 0;
+ font-size: 0.92308em; /* 12px / 13px */
+ font-weight: bold;
+}
+h6, .h6 {
+ margin-bottom: 0.5em;
+ color: #917122;
+ font-size: 0.76923em; /* 10px / 13px */
+}
+
+
+.page_content {
+ margin-bottom: 20px;
+}
+
+
+
+
+
+/****** BLOCKS ******/
+.block {
+ margin-bottom: 20px;
+}
+.block h3 {}
+
+.block_blue {
+ margin-bottom: 20px;
+ padding: 10px;
+ color: #fff;
+ background-color: #2F96B4;
+}
+.block_blue h3 {}
+
+.block_green {
+ margin-bottom: 20px;
+ padding: 10px;
+ color: #fff;
+ background-color: #51A351
+}
+.block_green h3 {}
+
+
+
+
+
+/****** EOF ******/
View
51 skins/front/default/css/style.css
@@ -7,60 +7,9 @@ html, body {
body {
margin: 0;
padding: 0;
- color: #292929;
- font-size: 13px;
- line-height: 1.3;
- font-family: Arial, sans-serif;
background-color: #ddd;
}
-a {
- color: #0066cc;
- cursor: pointer;
- text-decoration: none;
-}
-a:visited {
- color: #0066cc;
-}
-a:hover {
- color: #0066cc;
- text-decoration: none;
-}
-
-p, h1, h2, h3, h4, h5, h6, ul, ol, table {
- margin: 0 0 1em 0;
-}
-
-h1, .h1 {
- margin-bottom: 0.5em;
- font-size: 1.61538em; /* 21px / 13px */
- font-weight: bold;
-}
-h2, .h2 {
- margin-bottom: 0.5em;
- font-size: 1.53846em; /* 20px / 13px */
- font-weight: bold;
-}
-h3, .h3 {
- margin-bottom: 0.5em;
- font-size: 1.15385em; /* 15px / 13px */
- font-weight: bold;
-}
-h4, .h4 {
- font-size: 1em; /* 13px / 13px */
- font-weight: bold;
-}
-h5, .h5 {
- margin-bottom: 0;
- font-size: 0.92308em; /* 12px / 13px */
- font-weight: bold;
-}
-h6, .h6 {
- margin-bottom: 0.5em;
- color: #917122;
- font-size: 0.76923em; /* 10px / 13px */
-}
-
View
4 skins/front/default/footer.template.php
@@ -12,8 +12,8 @@
</div>
- <script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
- <script>window.jQuery || document.write('<script src="/libs/jquery-1.7.2.min.js"><\/script>')</script>
+ <script src="//ajax.googleapis.com/ajax/lib/jquery/1.7.2/jquery.min.js"></script>
+ <script>window.jQuery || document.write('<script src="/lib/jquery-1.7.2.min.js"><\/script>')</script>
<?= (count($registry->js) ? join("\n", $registry->js) : ''); ?>
</body>
View
1  skins/front/default/header.template.php
@@ -9,6 +9,7 @@
<?= (count($registry->css) ? join("\n", $registry->css) : ''); ?>
<link rel="stylesheet" href="/skins/front/default/css/grid.css" media="all" />
<link rel="stylesheet" href="/skins/front/default/css/style.css" media="all" />
+ <link rel="stylesheet" href="/skins/front/default/css/content.css" media="all" />
</head>
<body>
View
0  skins/front/default/layout.blog.template.php → skins/front/default/layout.blogs.template.php
File renamed without changes
View
4 skins/front/default/page.index.template.php → skins/front/default/pages.content.template.php
@@ -1,4 +1,6 @@
- <?= $content; ?>
+ <div class="page_content">
+ <?= $content; ?>
+ </div>
<?php /*echo '<pre>' . print_r(get_defined_vars(), true) . '</pre>';*/ ?>
<?php /*echo '<pre>' . print_r($layout, true) . '</pre>';*/ ?>
Please sign in to comment.
Something went wrong with that request. Please try again.