👾 php

php 파라미터 읽고 배열에 넣어서 li 반복

(。θᗨθ。) 2022. 12. 15. 16:57
<ul class="pdMenu">
<?php if ($getCookieLang === "ko") : ?>
    <?php
      $pdArray = array(
        "pd_cylinder" => "유압실린더",
        "pd_pump" => "유압펌프",
        "pd_equipment" => "유압장비",
        "pd_HLS" => "유압시스템",
        "pd_transfer" => "이송시스템",
        "pd_bolting" => "볼팅툴",
        "pd_partner" => "파트너",
      );
elseif ($getCookieLang === "en") :
      $pdArray = array(
        "pd_cylinder" => "Hydraulic Cylinder",
        "pd_pump" => "Hydraulic Pump",
        "pd_equipment" => "Hydraulic Equipment",
        "pd_HLS" => "Heavy Lifting System",
        "pd_transfer" => "Transfer System",
        "pd_bolting" => "Bolting Tool",
        "pd_partner" => "Partner",
      );
endif ?>

<? foreach ($pdArray as $key => $val) : ?>
  <li class="<?= strpos($_SERVER["REQUEST_URI"], $key) ? "on" : "" ?>">
    <a href="/board/bbs/board.php?bo_table=<?= $key ?>" class="dep1"><?= $val ?></a>
    <?php if ($is_category) { ?>
      <ul class="dep2">
        <?php echo $category_option ?>
      </ul><!-- .dep2 -->
    <?php } ?>
  </li>
<?php endforeach ?>
</ul><!-- .pdMenu -->
728x90