Skip to content

Instantly share code, notes, and snippets.

@foxp2
Last active December 15, 2015 15:58
Show Gist options
  • Save foxp2/5285248 to your computer and use it in GitHub Desktop.
Save foxp2/5285248 to your computer and use it in GitHub Desktop.
automactic & smart loader for each column. Example with twig_bm_categories extending bm_categorie class and its template file
{% block columnleft %}
<div id="columnTwigLeft" class="span{{ GridColumnWidth }}">
{% for boxe in boxes %}
{% if boxe.boxe != null and boxe.group == 'boxes_column_left' %}
{% include [boxe.boxe, TwigExtension]|join with{'data': boxe.data, 'title' : boxe.title } %}
{% endif %}
{% endfor %}
</div>
{% endblock %}
{% block appcontent %}
{% endblock %}
{% block columnright %}
<div id="columnTwigRight" class="span{{ GridColumnWidth }}">
{% for boxe in boxes %}
{% if boxe.boxe != null and boxe.group == 'boxes_column_right' %}
{% include [boxe.boxe, TwigExtension]|join with{'data': boxe.data, 'title' : boxe.title } %}
{% endif %}
{% endfor %}
</div>
{% endblock %}
{# Copyright (c) 2013 FoxP2; http://www.oscommerce.fr #}
{# file: includes/modules/boxes/view/template/classic/twig_bm_categories.html.twig #}
<div class="media well">
<span class="pull-left">
<i class="icon-list icon-large text-info"></i>
</span>
<div class="media-body">
<h4 class="media-heading text-info">{{ title }}</h4>
<ul class="nav nav-list">
{{ data | raw }}
</ul>
</div>
</div>
<?php
/**
* osCommerce Online Merchant
*
* @copyright Copyright (c) 2013 osCommerce; http://www.oscommerce.com
* @copyright Copyright (c) 2013 FoxP2; http://www.oscommerce.fr
* @license GNU General Public License; http://www.oscommerce.com/gpllicense.txt
*/
require(DIR_WS_MODULES . 'boxes/bm_categories.php');
class twig_bm_categories extends bm_categories {
var $code = 'twig_bm_categories';
public function __construct() {
parent::bm_categories();
}
public function execute() {
global $cPath;
$OSCOM_CategoryTree = new category_tree();
$OSCOM_CategoryTree->setCategoryPath($cPath, '<strong>','</strong>');
$OSCOM_CategoryTree->setRootString('<i class="icon-chevron-right pull-left text-info" style="padding-top:5px;"></i>','');
$OSCOM_CategoryTree->setParentGroupString('<ul class="nav nav-list">', '</ul>');
$data = array('data' => $OSCOM_CategoryTree->getTree(),
'group' => $this->group,
'boxe' => $this->code,
'enabled' => $this->enabled,
'sort_order' => $this->sort_order,
'title' => $this->title);
return $data;
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment