Page 1 sur 1

3 colonnes

Posté : 12 mai 2013, 13:51
par guigui
Bonjour, j'utilise un module pour filtrer des champs , j'aimerais les afficher sur 3 colonnes mais ça ne marche pas qui pourrait m'aider s'il vous plait voici le code :
Merci d'avance pour votre aide
defined('_JEXEC') or die('Restricted access');
?>
<style>
.filter-icon {
margin-right: 5px;
line-height: 30px;
}
#filter-form input[type="text"][name^="filters"],
#filter-form input[type="text"][class="cdate-field"],
#filter-form select {
width: 100%;
box-sizing: border-box;
margin: 0;
min-height: 28px;
}
#filter-form select {
margin-bottom: 5px;
}
.well.active {
border: 3px solid;
position: relative;
}
.well.active img.filter-close {
position: absolute;
top: -7px;
right: -7px;
cursor: pointer;
}
</style>
<form action="<?php echo JRoute::_('index.php');?>" method="post" name="filterform" id="filter-form">
<?php if($params->get('filter_search', 1)):?>
<div class="row-fluid <?php echo ( $state->get('records.search')? ' active' : NULL)?>">
<input type="text" class="span12" name="filter_search" value="<?php echo $state->get('records.search');?>" />
</div>
<?php endif;?>
 
<?php if( count($f_types) > 1):?>
<legend>
<?php if($params->get('show_icons', 1)):?>
<span class="pull-left filter-icon"><?php echo HTMLFormatHelper::icon('block.png');?></span>
<?php endif;?>
<?php echo $params->get('type_label');?>
</legend>
<div class="well well-small<?php echo ( $state->get('records.type')? ' active' : NULL)?>">
<?php if($params->get('filter_type_type') == 1):?>
<?php foreach ($f_types AS $type):?>
<label class="checkbox">
<input id="type-<?php echo $type->id?>" type="checkbox" name="filters[type][]" value="<?php echo $type->id?>"<?php echo $type->filter_checked?>>
<?php echo $type->name;?>
</label>
<?php endforeach;?>
<?php else :?>
<?php echo JHtml::_('select.genericlist', $f_types, 'filters[type]', null, 'id', 'name', $state->get('records.type'));?>
<?php endif;?>
</div>
<?php endif;?>
 
<?php if($params->get('filter_tags_type')):?>
<legend>
<?php if($params->get('show_icons', 1)):?>
<span class="pull-left filter-icon"><?php echo HTMLFormatHelper::icon('price-tag.png');?></span>
<?php endif;?>
<?php echo $params->get('tag_label');?>
</legend>
<div class="well well-small<?php echo ( $state->get('records.tag')? ' active' : NULL)?>">
<?php if($params->get('filter_tags_type') == 1):?>
<?php echo JHtml::_('tags.tagform', $section, $state->get('records.tag'));?>
<?php elseif($params->get('filter_tags_type') == 2):?>
<?php echo JHtml::_('tags.tagcheckboxes', $section, $state->get('records.tag'));?>
<?php elseif($params->get('filter_tags_type') == 3):?>
<?php echo JHtml::_('tags.tagselect', $section, $state->get('records.tag'));?>
<?php elseif($params->get('filter_tags_type') == 4):?>
<?php echo JHtml::_('tags.tagpills', $section, $state->get('records.tag'));?>
<?php endif;?>
</div>
<?php endif;?>
 
<?php if($params->get('filter_users_type')):?>
<legend>
<?php if($params->get('show_icons', 1)):?>
<span class="pull-left filter-icon"><?php echo HTMLFormatHelper::icon('user.png');?></span>
<?php endif;?>
<?php echo $params->get('user_label');?>
</legend>
<div class="well well-small<?php echo ( $state->get('records.user')? ' active' : NULL)?>">
<?php if($params->get('filter_users_type') == 1):?>
<?php echo JHtml::_('users.form', $section, $state->get('records.user'));?>
<?php elseif($params->get('filter_users_type') == 2):?>
<?php echo JHtml::_('users.checkboxes', $section, $state->get('records.user'));?>
<?php elseif($params->get('filter_users_type') == 3):?>
<?php echo JHtml::_('users.select', $section, $state->get('records.user'));?>
<?php endif;?>
</div>
<?php endif;?>
 
<?php if($params->get('filter_category_type')):?>
<legend>
<?php if($params->get('show_icons', 1)):?>
<span class="pull-left filter-icon"><?php echo HTMLFormatHelper::icon('category.png');?></span>
<?php endif;?>
<?php echo $params->get('category_label');?>
</legend>
<div class="well well-small<?php echo ( $state->get('records.category')? ' active' : NULL)?>">
<?php if($params->get('filter_category_type') == 1):?>
<?php echo JHtml::_('categories.form', $section, $state->get('records.category'));?>
<?php elseif($params->get('filter_category_type') == 2):?>
<?php echo JHtml::_('categories.checkboxes', $section, $state->get('records.category'), array('columns' => 3));?>
<?php elseif($params->get('filter_category_type') == 3):?>
<?php echo JHtml::_('categories.select', $section, $state->get('records.category'), array('multiple' => 0));?>
<?php elseif($params->get('filter_category_type') == 4):?>
<?php echo JHtml::_('categories.select', $section, $state->get('records.category'), array('multiple' => 1, 'size' => 25));?>
<?php endif;?>
</div>
<?php endif;?>
 
$cols = 3;
$rows = 3
if($rows <= 0) $rows = 0;
 
 
<?php foreach ($filters AS $filter):?>
<?php if( in_array($filter->key, ( array)$params->get('field_id_exclude', array()))) continue;?>
<div class="row-fluid">
<?php for($c = 0; $c < $cols; $c++):?>
<legend>
<?php if($params->get('show_icons', 1) && $filter->params->get('core.icon')):?>
<span class="pull-left filter-icon"><?php echo HTMLFormatHelper::icon($filter->params->get('core.icon'));?></span>
<?php endif;?>
<?php echo $filter->label;?>
<?php if($filter->params->get('params.filter_descr')):?>
<small rel="tooltip" data-original-title="<?php echo JText::_($filter->params->get('params.filter_descr'));?>"><i class="icon-help"></i></small>
<?php endif;?>
</legend>
<div class="well well-small<?php if($filter->isFilterActive()) echo ' active'?>">
<?php if($filter->isFilterActive()):?>
<!-- <img class="filter-close" onclick="Cobalt.cleanFilter('filter_<?php echo $filter->key?>')" rel="tooltip" data-original-title="<?php echo JText::_('CDELETEFILTER')?>" src="<?php echo JUri::root(true)?>/media/mint/icons/16/cross-circle.png">-->
<?php endif;?>
<?php echo $filter->onRenderFilter($section, TRUE);?>
</div>
</div>
<?php endfor;?>
 
<?php endforeach;?>
 
<input type="hidden" name="option" value="com_cobalt">
<input type="hidden" name="view" value="records">
<input type="hidden" name="section_id" value="<?php echo $section->id;?>">
<input type="hidden" name="cat_id" value="<?php echo $cat_id;?>">
<input type="hidden" name="user_id" value="<?php echo ($user_id ? $user_id.':admin' : 0);?>">
<input type="hidden" name="view_what" value="<?php echo $vw;?>">
<input type="hidden" name="task" value="records.filters">
<input type="hidden" name="limitstart" value="0">
<div class="form-actions">
<button type="submit" class="btn btn-primary btn-large">
<?php echo JText::_('CSEARCH');?>
</button>
</div>
</form>

Re: 3 colonnes

Posté : 12 mai 2013, 16:07
par moogli
Modération :
Afin d'améliorer la lisibilité de ton message,
pense à utiliser les balises [code] ou [php] (selon le langage utilisé).

Elles sont disponibles au-dessus de la zone de saisie de ton message
lorsque tu postes un nouveau message.

Des indications sont disponibles sur la manière de mettre en forme vos messages dans la FAQ


En règle général un affichage multi colonne est réalisé a partir de l'opérateur modulo (%) et d'une variable compteur qui est incrémentée a chaque lignes affichées. Si le résultat du modulo est zéro tu change de ligne.

Exemple
<?php
$data = [];
$i = 0 ;
Foreach( $data as $d){
if($i > 0 && ($i % 3)) {
// nouvelle ligne 
}
// affichage de case avec la donnée 
}

@+