1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-06 06:38:00 +02:00

more featurebox flexibility

This commit is contained in:
secretr
2009-12-11 13:45:12 +00:00
parent ffaf88d2dd
commit 7758486759

View File

@@ -1,7 +1,7 @@
<?php <?php
/* /*
* Copyright (c) e107 Inc 2009 - e107.org, Licensed under GNU GPL (http://www.gnu.org/licenses/gpl.txt) * Copyright (c) e107 Inc 2009 - e107.org, Licensed under GNU GPL (http://www.gnu.org/licenses/gpl.txt)
* $Id: e_shortcode.php,v 1.7 2009-12-11 13:12:38 secretr Exp $ * $Id: e_shortcode.php,v 1.8 2009-12-11 13:45:12 secretr Exp $
* *
* Featurebox shortcode batch class - shortcodes available site-wide. ie. equivalent to multiple .sc files. * Featurebox shortcode batch class - shortcodes available site-wide. ie. equivalent to multiple .sc files.
*/ */
@@ -155,6 +155,7 @@ class featurebox_shortcodes // must match the plugin's folder name. ie. [PLUGIN_
* Available parameters (GET string format) * Available parameters (GET string format)
* - loop (boolean): loop using 'nav_loop' template, default 0 * - loop (boolean): loop using 'nav_loop' template, default 0
* - base (string): template key prefix, default is 'nav'. Example: 'mynav' base key will search templates 'mynav_start', 'mynav_loop', 'mynav_end'. * - base (string): template key prefix, default is 'nav'. Example: 'mynav' base key will search templates 'mynav_start', 'mynav_loop', 'mynav_end'.
* - nolimit (boolean): ignore 'limit' field , us 'total' items number for navigation looping
* *
* @param string $parm parameters * @param string $parm parameters
* @param string $mod category template * @param string $mod category template
@@ -199,7 +200,8 @@ class featurebox_shortcodes // must match the plugin's folder name. ie. [PLUGIN_
if(isset($parm['loop']) && $tree->getTotal() > 0 && vartrue($tmpl[$base.'item'])) if(isset($parm['loop']) && $tree->getTotal() > 0 && vartrue($tmpl[$base.'item']))
{ {
$total = ceil($tree->getTotal() / ($category->sc_featurebox_category_limit() ? intval($category->sc_featurebox_category_limit()) : $tree->getTotal()) ); if(isset($parm['nolimit'])) $total = $tree->getTotal();
else $total = ceil($tree->getTotal() / ($category->sc_featurebox_category_limit() ? intval($category->sc_featurebox_category_limit()) : $tree->getTotal()) );
$model = clone $category; $model = clone $category;
$tmp = array(); $tmp = array();
for ($index = 1; $index <= $total; $index++) for ($index = 1; $index <= $total; $index++)
@@ -265,8 +267,7 @@ class featurebox_shortcodes // must match the plugin's folder name. ie. [PLUGIN_
$cols = intval(vartrue($parm['cols'], 1)); $cols = intval(vartrue($parm['cols'], 1));
$limit = intval(varset($parm['limit'], $category->sc_featurebox_category_limit())); $limit = intval(varset($parm['limit'], $category->sc_featurebox_category_limit()));
$from = (intval(vartrue($parm['from'], 1)) - 1) * $cols; $from = (intval(vartrue($parm['from'], 1)) - 1) * $limit;
$category->setParam('cols', $cols) $category->setParam('cols', $cols)
->setParam('no_fill_empty', isset($parm['no_fill_empty']) ? 1 : 0) ->setParam('no_fill_empty', isset($parm['no_fill_empty']) ? 1 : 0)
->setParam('limit', $limit) ->setParam('limit', $limit)