(Solution) List DIV template and row ID problem

urbido

Member
Hi,
we have problem for the DIV template, when we need to have specific ID for each row.
By default there is a same id of the last record in every row. We made a solution for it.

in views\tmpl\list\div\default.php you have to replace on line 85
PHP:
    $items = array();
    foreach ($group as $this->_row) :
        $items[] = $this->loadTemplate('row');
    endforeach;
    $class = 'fabrik_row well row-striped';
    echo FabrikHelperHTML::bootstrapGrid($items, $columns, $class, true, $this->_row->id);

    ?>
with this
PHP:
    $items = array();
    $ids = array();
    foreach ($group as $this->_row) :?>
        <?php $items[] = $this->loadTemplate('row');?>
        <?php $ids[] = $this->_row->id;?>

    <?php endforeach;
        $class = 'row-list uk-padding-small ' . $this->_row->class;
        echo FabrikHelperHTML::bootstrapGrid($items, $columns, $class, true, $ids);
    ?>

and in layouts\fabrik/bootstrap/grid.php you have to replace on line 16
PHP:
$id   = is_null($d->spanId) ? '' : ' id="' . $d->spanId . '"';
$grid = array();

foreach ($d->items as $i => $s)
{
    $endLine = ($i !== 0 && (($i) % $d->columns == 0));
    $newLine = ($i % $d->columns == 0);

    if ($endLine)
    {
        $grid[] = '</div><!-- grid close row -->';
    }

    if ($newLine)
    {
        $grid[] = '<div class="row-fluid">';
    }
    $grid[] = '<div class="' . $d->spanClass . ' span' . $span . '"' . $id . '>' . $s . '</div>';
}
with this
PHP:
//$id   = is_null($d->spanId) ? '' : ' id="' . $d->spanId . '"';
$grid = array();

foreach ($d->items as $i => $s)
{
    $endLine = ($i !== 0 && (($i) % $d->columns == 0));
    $newLine = ($i % $d->columns == 0);

    if ($endLine)
    {
        $grid[] = '</div><!-- grid close row -->';
    }

    if ($newLine)
    {
        $grid[] = '<div class="row-fluid">';
    }
    $id = is_null($d->spanId[$i]) ? '' : ' id="' . $d->spanId[$i] . '"';
    $grid[] = '<div class="' . $d->spanClass . ' span' . $span . '"' . $id . '>' . $s . '</div>';
}

Maybe this solution could be implemented into the source code.
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top