Add Active Class Dynamically In Naviagtion Menu Using Bootstrap 4 & PHP

preview_player
Показать описание
Hello guyz! In this video I'm showing you how to set active class on the navigation link dyanamically using Bootstrap 4 and PHP.

If you like my works and my video tutorials then you can donate me some amount. You can donate through these links :



Thanks for watching this video. If you like this video then hit like button, share this video, And Subscribe my Channel. Also like my Facebook page for latest updates.

-~-~~-~~~-~~-~-
Please watch: "#1 Payment Gateway Integration Using PHP (Instamojo) | Introduction Video"
-~-~~-~~~-~~-~-
Рекомендации по теме
Комментарии
Автор

i love avoiding javascript and jqerry using simple php echo to output into the html whatever i want is freeing, amazing...thanks for keeping it simple

glent
Автор

hello my friend, congratulations for the video, great explanation, it helped me a lot.

fabiosanchez
Автор

Hi! Thanks for this, i tryed to make this work for a week. Realy thanks!

henchit
Автор

Now, how do you get that styling for the ".active" link? I see that becomes white, but how do you get it? I didn't see any CSS in your design. So that "active" style comes from bootstrap CSS?

toma
Автор

hi, if a link having menu at that time what will happen.

bejjankipradeepkumar
Автор

Hello dear, very good video, now I have two queries, first, with a single if you solve the problem, logically, if it is the same, you add the class "active" and if it is not, you do not even launch the else. On the other hand, if I have a menu of 30 items, isn't it counterproductive to make a conditional for each of them? Wouldn't it be better to do it with pure javascript and go through the items or listen to the click event? Well I really liked the idea, greetings and thanks!

NicoILeone
Автор

how to have other active link like that of home?

prashantbhatta
Автор

this my solution, you can use MVC concept and like this

<?= (App::$page == 'kegiatan') ? 'active' : '' ?>

App class for handle the url
$page is static variable that contain the controller variable

aibnu