diff --git a/e107_plugins/featurebox/e_shortcode.php b/e107_plugins/featurebox/e_shortcode.php index 97e31799c..ce7a1913e 100644 --- a/e107_plugins/featurebox/e_shortcode.php +++ b/e107_plugins/featurebox/e_shortcode.php @@ -1,7 +1,7 @@ getCategoryModel($ctemplate); + $category = $this->getCategoryModel($ctemplate); if(!$category->hasData()) { return ''; @@ -196,11 +196,13 @@ class featurebox_shortcodes // must match the plugin's folder name. ie. [PLUGIN_ $base = vartrue($parm['base'], 'nav').'_'; $ret = $category->toHTML(varset($tmpl[$base.'start']), true); + if(isset($parm['loop']) && $tree->getTotal() > 0 && vartrue($tmpl[$base.'item'])) { - $total = ceil($tree->getTotal() / $category->sc_featurebox_category_limit()); + $total = ceil($tree->getTotal() / ($category->sc_featurebox_category_limit() ? intval($category->sc_featurebox_category_limit()) : $tree->getTotal()) ); $model = clone $category; $tmp = array(); + var_dump($category->sc_featurebox_category_limit()); for ($index = 1; $index <= $total; $index++) { $tmp[] = $model->setParam('counter', $index) @@ -226,7 +228,7 @@ class featurebox_shortcodes // must match the plugin's folder name. ie. [PLUGIN_ } /** - * Render featurebox navigation + * Get & Render featurebox items (custom) * Available parameters (GET string format) * - cols (integer): number of items per column, default 1 * - no_fill_empty (boolean): don't fill last column with empty items (if required), default 0 @@ -271,7 +273,7 @@ class featurebox_shortcodes // must match the plugin's folder name. ie. [PLUGIN_ ->setParam('limit', $limit) ->setParam('from', $from); - $tree = $category->getItemTree(true); + $tree = $category->getItemTree(true); if($tree->isEmpty()) { return ''; @@ -282,6 +284,7 @@ class featurebox_shortcodes // must match the plugin's folder name. ie. [PLUGIN_ $counter = 1; $col_counter = 1; $ret = ''; + foreach ($tree->getTree() as $id => $node) { $tmpl_item = e107::getTemplate('featurebox', 'featurebox', $node->get('fb_template')); diff --git a/e107_plugins/featurebox/includes/item.php b/e107_plugins/featurebox/includes/item.php index 023bbdd98..3cc57e341 100644 --- a/e107_plugins/featurebox/includes/item.php +++ b/e107_plugins/featurebox/includes/item.php @@ -9,9 +9,9 @@ * Featurebox Item model * * $Source: /cvs_backup/e107_0.8/e107_plugins/featurebox/includes/item.php,v $ -* $Revision: 1.4 $ -* $Date: 2009-12-11 00:36:30 $ -* $Author: e107coders $ +* $Revision: 1.5 $ +* $Date: 2009-12-11 13:11:35 $ +* $Author: secretr $ * */ @@ -103,37 +103,62 @@ class plugin_featurebox_item extends e_model return 'getId().' href="'.$tp->replaceConstants($this->get('fb_imageurl'), 'full').'" title="'.$tp->toAttribute($this->get('fb_title')).'" rel="'.$tp->toAttribute(vartrue($parm['rel'], 'external')).'">'.$tag.''; } + /** + * Item counter number (starting from 1) + */ public function sc_featurebox_counter() { return $this->getParam('counter', 1); } + /** + * Item limit number + */ public function sc_featurebox_limit() { return $this->getParam('limit', 0); } + /** + * Number of items (real) currently loaded + */ public function sc_featurebox_total() { return $this->getParam('total', 0); } + /** + * Total Number of items (no matter of the limit) + */ public function sc_featurebox_all() { return $this->getCategory()->sc_featurebox_category_all(); } + /** + * Number of items per column + */ public function sc_featurebox_cols() { return $this->getParam('cols', 1); } - + /** + * Item counter number inside a column (1 to sc_featurebox_cols) + */ public function sc_featurebox_colcount() { return $this->getParam('col_counter', 1); } + /** + * Column counter + */ + public function sc_featurebox_colscount() + { + return $this->getParam('cols_counter', 1); + } + /** * Set current category * @param plugin_featurebox_category $category diff --git a/e107_plugins/featurebox/templates/featurebox_category_template.php b/e107_plugins/featurebox/templates/featurebox_category_template.php index 9d9e19b91..64ed05085 100644 --- a/e107_plugins/featurebox/templates/featurebox_category_template.php +++ b/e107_plugins/featurebox/templates/featurebox_category_template.php @@ -30,15 +30,15 @@ $FEATUREBOX_CATEGORY_TEMPLATE['default']['item_separator'] = '
tags -$FEATUREBOX_CATEGORY_TEMPLATE['dynamic']['js_inline'] = ''; +//$FEATUREBOX_CATEGORY_TEMPLATE['default']['js_inline'] = ''; /* * Dynamic Template