php - Joomla if else for menu by ID or url -
I have a situation under which I have to show my two pages differently, but they do not have front pages Are there. If they were, then it would be easy because the code given below will move.
$ menu = & amp; JSite :: getMenu (); If ($ menu-> getActive () == $ Menu- & gt; getDefault ()) {resonant 'This is the front page'; Esle (do something else)}? & Gt; In short, I want a similar approach, but this time, to get the menu by ID / URL. Any ideas?
I got the answer ... You only need to check the menu ID then the code below Enter
& lt ;? Php // This menu ID 6 $ menuID = JSite :: getMenu () - & gt; GetActive () -> is the code for the page with; Id; If ($ menuID == '6') {echo ''; } Elseif ($ menuID == '2') // This is HTML for page with menu id 2 {echo ''; } Elseif ($ menuID == '4') // This is html for page with menu id 4 {echo ''; } Else // This is the HTML code for the rest of the pages (echo '';}? & Gt;
Comments
Post a Comment