<?php
$url = explode('/',$_SERVER['REQUEST_URI']);
if (isset($url[2]) && isset($url[3]))
$text = '-'.$url[2].'-'.$url[3];
?>
<script>$('#Nav<?= $text; ?>').addClass("active");</script>