Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Cleaned up the default theme and added new features to parsers

  • Loading branch information...
commit 1965c15d85ebb39159050c1ecf4df786e0fe733c 1 parent 7ffc053
@ericbarnes ericbarnes authored
View
2  upload/system/68kb/cache/categories_model/7d04b033b9f522af841712167293feba43063c86.cache
@@ -1 +1 @@
-a:4:{s:16:"__cache_contents";a:1:{i:0;a:2:{s:8:"cat_name";s:6:"Parent";s:7:"cat_uri";s:6:"parent";}}s:15:"__cache_created";i:1281453477;s:20:"__cache_dependencies";a:0:{}s:15:"__cache_expires";i:1281457077;}
+a:4:{s:16:"__cache_contents";a:1:{i:0;a:2:{s:8:"cat_name";s:15:"Sales Questions";s:7:"cat_uri";s:15:"sales_questions";}}s:15:"__cache_created";i:1281459086;s:20:"__cache_dependencies";a:0:{}s:15:"__cache_expires";i:1281462686;}
View
2  upload/system/68kb/cache/load_addons.cache
@@ -1 +1 @@
-a:4:{s:16:"__cache_contents";a:0:{}s:15:"__cache_created";i:1281455959;s:20:"__cache_dependencies";a:0:{}s:15:"__cache_expires";i:1281456019;}
+a:4:{s:16:"__cache_contents";a:0:{}s:15:"__cache_created";i:1281460086;s:20:"__cache_dependencies";a:0:{}s:15:"__cache_expires";i:1281460146;}
View
2  upload/system/68kb/language/english/kb_lang.php
@@ -56,7 +56,7 @@
$lang['lang_short_description'] = 'Short Description';
$lang['lang_active'] = 'Active';
$lang['lang_not_active'] = 'Not Active';
-
+$lang['lang_no_articles'] = 'No articles in this category';
$lang['lang_all_articles'] = 'All Articles';
$lang['lang_article_not_available'] = 'Sorry this article is not available.';
View
7 upload/system/68kb/modules/categories/controllers/categories.php
@@ -106,9 +106,10 @@ public function index($uri='')
$data['category_id'] = $data['category']['cat_id'];
- $data['cat_allowads'] = $data['category']['cat_allowads'];
+ $this->load->model('kb/articles_model');
+ $data['has_articles'] = $this->articles_model->get_articles_by_catid($data['category_id']);
- $data['cat_promo'] = $data['category']['cat_promo'];
+ $data['cat_description'] = $data['category']['cat_description'];
$data['sub_cats'] = $this->categories_model->get_sub_categories($data['category_id']);
@@ -131,7 +132,7 @@ public function index($uri='')
$this->template->title(lang('lang_categories'));
$data['cat_name'] = lang('lang_categories');
$data['breadcrumb'] = $this->categories_model->breadcrumb(0);
- $data['listings'] = '';
+ $data['has_articles'] = 0;
$data['cat_allowads'] = 'no';
}
View
20 upload/system/68kb/modules/categories/libraries/Categories_parser.php
@@ -181,6 +181,7 @@ function table($data = '')
'show_total' => 'no',
'show_image' => 'yes',
'show_description' => 'no',
+ 'heading' => '',
'cols' => 2,
'table_attr' => 'width="100%" class="cat_table"',
'row_start' => '',
@@ -292,10 +293,11 @@ function table($data = '')
// Show the total listings in this category and all children
if ($options['show_total'] == 'yes')
{
- $this->_ci->benchmark->mark('cat_pi_total_listings_start');
- $total = $this->_ci->categories_model->total_listings($row['cat_id']);
+ $this->_ci->benchmark->mark('cat_pi_total_articles_start');
+ $this->_ci->load->library('categories/categories_library');
+ $total = $this->_ci->categories_model->total_articles($row['cat_id']);
$td .= ' <span class="total">('.$total.')</span>';
- $this->_ci->benchmark->mark('cat_pi_total_listings_end');
+ $this->_ci->benchmark->mark('cat_pi_total_articles_end');
}
// Show the description
@@ -312,13 +314,19 @@ function table($data = '')
}
$new_list = $this->_ci->table->make_columns($cats, $options['cols']);
-
- $table = $this->_ci->table->generate($new_list);
+
+ $output = '';
+ if ($options['heading'] <> '')
+ {
+ $output .= '<h2>'.$options['heading'].'</h2>';
+ }
+
+ $output .= $this->_ci->table->generate($new_list);
// finally clear the template incase it is used twice.
$this->_ci->table->clear();
- return $table;
+ return $output;
}
// ------------------------------------------------------------------------
View
17 upload/system/68kb/modules/categories/models/categories_model.php
@@ -562,7 +562,7 @@ public function breadcrumb($cat_id, $lev = 0)
* @param int $lev The current level
* @return array
*/
- public function total_listings($cat_id, $lev = 0)
+ public function total_articles($cat_id, $lev = 0)
{
$cat_id = (int) $cat_id;
@@ -576,18 +576,17 @@ public function total_listings($cat_id, $lev = 0)
return 0;
}
- $this->db->select('listing_id')
- ->from('listings')
- ->join('listing_status', 'listing_status = status_id', 'inner')
- ->where('listing_expiration >', time())
- ->where_in('listing_category', $search_cats);
+ $this->db->select('article_id')
+ ->from('articles')
+ ->join('article2cat', 'article_id = article_id_rel', 'inner')
+ ->where_in('category_id_rel', $search_cats);
- $where = 'status_show_listing = "y" AND listing_expiration > '. time();
+ $where = 'article_display = "y"';
// Call any hooks and add them to the where clause.
- if ($this->events->active_hook('get_listings_where'))
+ if ($this->events->active_hook('get_articles_where'))
{
- $where .= $this->events->trigger('get_listings_where');
+ $where .= $this->events->trigger('get_articles_where');
}
$this->db->where($where);
View
14 upload/system/68kb/modules/kb/libraries/Articles_parser.php
@@ -45,13 +45,13 @@ function __construct($data = array())
* @param array
* @return mixed
*/
- function get()
+ function get($data = array())
{
// Set the default options
- $defaults = array('limit' => '', 'owner' => '', 'category' => '', 'class' => '', 'extra_field' => '', 'sort_order' => 'random', 'sort_column' => 'article_title', 'cache' => 0, 'exclude' => '');
-
- $options = $this->_ci->settings->get_params($this->_data['attributes'], $defaults);
+ $defaults = array('limit' => '', 'owner' => '', 'category' => '', 'class' => '', 'extra_field' => '', 'sort_order' => 'asc', 'sort_column' => 'article_title', 'cache' => 0, 'exclude' => '');
+ $options = $this->_ci->settings->get_params($data['attributes'], $defaults);
+
// Do the listings query
$this->_ci->db->start_cache();
$this->_ci->db->from('articles')
@@ -119,9 +119,9 @@ function get()
$allowed_order_by = array('asc', 'desc', 'random');
$sort_order = 'asc';
- if ( ! in_array(strtolower($options['sort_order']), $allowed_order_by))
+ if (in_array(strtolower($options['sort_order']), $allowed_order_by))
{
- $sort_order = 'desc';
+ $sort_order = $options['sort_order'];
}
// This sets the allowed order by clauses. Prevents invalid query.
@@ -163,7 +163,7 @@ function get()
}
$query = $this->_ci->db->get();
-
+
// no records so we can't continue
if ($query->num_rows() == 0)
{
View
8 upload/system/68kb/modules/kb/models/articles_model.php
@@ -336,13 +336,13 @@ function get_articles()
* @param bool
* @return mixed
*/
- function get_articles_by_catid($id, $limit=0, $current_row = 0, $show_count=FALSE)
+ function get_articles_by_catid($id, $limit = 0, $current_row = 0, $show_count = TRUE)
{
$id = (int)$id;
$this->db->from('articles');
- $this->db->join('article2cat', 'articles.article_id = article2cat.article_id', 'left');
- $this->db->where('category_id', $id);
- $this->db->where('article_display', 'Y');
+ $this->db->join('article2cat', 'article_id = article_id_rel', 'left');
+ $this->db->where('category_id_rel', $id);
+ $this->db->where('article_display', 'y');
if ($show_count)
{
return $this->db->count_all_results();
View
31 upload/themes/default/categories/browse.php
@@ -1,19 +1,28 @@
<?php // Any subcategories? ?>
-{kb:categories:table cat_parent="<?php echo $category_id; ?>"}
+{kb:categories:table heading="Sub Categories" show_total="yes" cat_parent="<?php echo $category_id; ?>"}
-<?php if (isset($category_id)): ?>
+<?php if (isset($category_id) && $category_id > 0): ?>
- <h2>{kb:cat_name} Articles</h2>
+ <h2 class="cat_name">{kb:cat_name}</h2>
+ <p class="cat_description">{kb:cat_description}</p>
- <ul class="articles">
- {kb:articles:get category="<?php echo $category_id; ?>"}
- <li><a href="{kb:article_url}">{kb:article_title}</a></li>
- {/kb:articles:get}
- </ul>
+ <?php if ($has_articles > 0): ?>
+
+ <ul class="articles">
+ {kb:articles:get category="<?php echo $category_id; ?>"}
+ <li><a href="{kb:article_url}">{kb:article_title}</a></li>
+ {/kb:articles:get}
+ </ul>
- <div class="pagination">
- {kb:articles:paging}
- </div>
+ <div class="pagination">
+ {kb:articles:paging}
+ </div>
+
+ <?php else: ?>
+
+ <p>{lang:lang_no_articles}</p>
+
+ <?php endif; ?>
<?php endif; ?>
View
19 upload/themes/default/css/style.css
@@ -71,6 +71,21 @@ ul.articles li {
padding:0 0 5px 20px;
}
+hr {
+ border: none;
+ border-top: 1px solid #ccc;
+ background: #fff;
+ height: 1px;
+}
+#home h3 {
+ color:#626262;
+ font-size:14px;
+ line-height:1.3;
+ margin:0 0 10px;
+}
+#home li {
+ line-height:18px;
+}
.glossary_terms td {
margin: 0;
padding: 0;
@@ -97,9 +112,7 @@ dd {
margin:0;
padding-top:15px;
}
-.cat_table {
- border-bottom: 1px solid #ccc;
-}
+
.cat_table td {
padding: 5px;
}
View
30 upload/themes/default/home.php
@@ -1,10 +1,22 @@
-<div class="grid_4 alpha">
- <h2>Featured Articles</h2>
-
-</div>
-<div class="grid_4 omega">
- <h2>Recent Articles</h2>
- {kb:articles:get}
- <p><strong>{kb:article_title}</strong></p>
- {/kb:articles:get}
+<div id="home">
+
+ {kb:categories:table heading="{lang:lang_categories}" cat_parent="0" cols="3" show_total="yes"}
+ <hr />
+
+ <div class="grid_4 alpha">
+ <h3>Most Popular</h3>
+ <ol>
+ {kb:articles:get sort_column="article_hits" sort_order="desc"}
+ <li><a href="{kb:article_url}">{kb:article_title}</a></li>
+ {/kb:articles:get}
+ </ol>
+ </div>
+ <div class="grid_4 omega">
+ <h3>Recent Articles</h3>
+ <ol>
+ {kb:articles:get sort_column="article_date" sort_order="desc"}
+ <li><a href="{kb:article_url}">{kb:article_title}</a></li>
+ {/kb:articles:get}
+ </ol>
+ </div>
</div>
Please sign in to comment.
Something went wrong with that request. Please try again.