在php表格中显示不同的级别

在php表格中显示不同的级别,php,html,Php,Html,我有一个表格自动填写foreaches,我需要在每个级别添加一个数字和一个点。我有一个foreach和每个类别/子类别的计数 例:第一类。子类别1.1儿童类别1.1.1 事情就是这样 我现在只显示了第一个类别和子类别 $i=1; $is=1.1; $if='1.1.1'; $iff='1.1.1.1'; ?> 范畴 描述 Ações 运算符将递增一个数字。它不能处理像“1.1.1”这样的字符串。您必须自己编写代码来增加这些值。 $i = 1; $is = 1.1; $if = '1.

我有一个表格自动填写foreaches,我需要在每个级别添加一个数字和一个点。我有一个foreach和每个类别/子类别的计数

例:第一类。子类别1.1儿童类别1.1.1

事情就是这样

我现在只显示了第一个类别和子类别

$i=1;
$is=1.1;
$if='1.1.1';
$iff='1.1.1.1';
?>
范畴
描述
Ações

运算符将递增一个数字。它不能处理像“1.1.1”这样的字符串。您必须自己编写代码来增加这些值。
    $i = 1;
$is = 1.1;
$if = '1.1.1';
$iff = '1.1.1.1';

?>
<!-- TABELA DE CATEGORIAS -->
<table class="table">
    <thead>
        <tr>
            <th style="width:50%;">Categoria</th>
            <th style="width:70%">Descrição</th>
            <th>Ações</th>
        </tr>
    </thead>
    <tbody>
        <!-- PEGANDO AS CATEGORIAS -->
        <?php
        foreach ($exibiCategoria as $registro) :
        ?>
            <tr>
                <td><?php echo  $i, '. ' . $registro['nome_categoria'] ?></td>
                <td><?php echo $registro['desc_categoria'] ?></td>
                <td class="table-action">
                    <a data-toggle="modal" data-target="#cadastrarSubCatModal"><i class="align-middle" data-feather="plus-circle"></i></a>
                    <a href="?router=Orcamento/modalCat/&id_categoria=<?php echo base64_encode($registro['id_categoria']) ?>"><i class="align-middle" data-feather="edit-2"></i></a>
                    <a href="?router=Orcamento/modalDelete/&id_categoria=<?php echo base64_encode($registro['id_categoria']) ?>"><i class="align-middle" data-feather="trash"></i></a>
                </td>
            </tr>

            <!-- FIM CATEGORIAS -->


            <!-- PEGANDO AS SUB CATEGORIAS -->

            <?php
            foreach ($exibiCategoriaSub as $registroSub) :


                if ($registroSub['id_categoria'] == $registro['id_categoria']) {
            ?>

                    <tr>

                        <td><?php echo "&nbsp; &nbsp;" .  $is, '. ' . $registroSub['nome_sub_categoria'] ?></td>
                        <td><?php echo $registroSub['desc_sub_categoria'] ?></td>
                        <td class="table-action">
                            <a data-toggle="modal" data-target="#cadastrarCatFilhaModal"><i class="align-middle" data-feather="plus-circle"></i></a>
                            <a href="?router=Orcamento/modalSubCat/&id_categoria=<?php echo base64_encode($registro['id_categoria']) ?>"><i class="align-middle" data-feather="edit-2"></i></a>
                            <a href="?router=Orcamento/modalDeleteSubCat/&id_categoria=<?php echo base64_encode($registroSub['id_sub_categoria']) ?>"><i class="align-middle" data-feather="trash"></i></a>
                        </td>
                    </tr>
                    <?php

                    ?>
                    <!-- FIM SUB CATEGORIA -->

                    <!-- FPEGANDO CATEGORIA FILHA -->
                    <?php
                }
                foreach ($exibiCategoriaFilha as $registroFilha) :
                    if ($registroSub['id_categoria'] == $registro['id_categoria']) {
                        if ($registroSub['id_sub_categoria'] == $registroFilha['id_sub_categoria']) {
                    ?>
                            <tr>
                                <td><?php echo "&nbsp; &nbsp; &nbsp; &nbsp;" . $if, '. ' . $registroFilha['nome_categoria_filha'] ?> </td>
                                <td> <?php echo $registroFilha['desc_categoria_filha'] ?></td>
                                <td> <?php echo $registroFilha['id_categoria_filha'] ?></td>

                                <td class="table-action">
                                    <a data-toggle="modal" data-target="#cadastrarCatFilhaFModal"><i class="align-middle" data-feather="plus-circle"></i></a>
                                    <a href="?router=Orcamento/modalCatFilha/&id_categoria=<?php echo base64_encode($registroFilha['id_categoria_filha']) ?>"><i class="align-middle" data-feather="edit-2"></i></a>
                                    <a href="?router=Orcamento/modalDeleteCatFilha/&id_categoria=<?php echo base64_encode($registroFilha['id_categoria_filha']) ?>"><i class="align-middle" data-feather="trash"></i></a>
                                </td>
                            </tr>
                            <!-- FIM CATEGORIA FILHA -->

                            <!-- FPEGANDO CATEGORIA FILHA DA FILHA-->
                            <?php
                        }
                    }
                    foreach ($exibiCategoriaFilhaF as $registroFilhaF) :
                        if ($registroSub['id_categoria'] == $registro['id_categoria']) {
                            if ($registroSub['id_sub_categoria'] == $registroFilha['id_sub_categoria']) {
                                if ($registroSub['id_sub_categoria'] == $registroFilhaF['id_sub_categoria']) {
                                    if ($registroFilha['id_categoria_filha'] == $registroFilhaF['id_cat_filha']) {

                            ?>


                                        <tr>
                                            <td><?php echo "&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;"  . $iff, '. ' . $registroFilhaF['nome_categoria_filha'] ?> </td>
                                            <td> <?php echo $registroFilhaF['desc_categoria_filha'] ?></td>
                                            <td> <?php echo $registroFilhaF['id_cat_filha'] ?></td>
                                            <td> <?php echo $registroFilha['id_categoria_filha'] ?></td>
                                            <td class="table-action">
                                                <a data-toggle="modal" data-target="#cadastrarCatFilhaFFModal"><i class="align-middle" data-feather="plus-circle"></i></a>
                                                <a href="?router=Orcamento/modalCatFilha/&id_categoria=<?php echo base64_encode($registroFilhaF['id_categoria_filha']) ?>"><i class="align-middle" data-feather="edit-2"></i></a>
                                                <a href="?router=Orcamento/modalDeleteCatFilha/&id_categoria=<?php echo base64_encode($registroFilha['id_categoria_filha']) ?>"><i class="align-middle" data-feather="trash"></i></a>
                                            </td>
                                        </tr>

                                        <!-- FIM CATEGORIA FILHA DA FILHA -->
        <?php
                                    }
                                }
                            }
                        }
                    endforeach;

                    $i++;
                    $is++;
                    $if++;
                    $iff++;
                endforeach;
            endforeach;
        endforeach;
        ?>

        </td>
        </tr>
    </tbody>
</table>