Hello all,
I'm in the process of converting my site to 5.1 from 4.7, and I'm switching from using dashboard (old and busted) to panels (the new hotness). Problem is, I have a block with a menu that applies an "active" class to certain list items based on the node ID, the result being that the button pointing to the dashboard you're already on is greyed out. This worked great on 4.7 / dashboard.
This is done using the following:
<?php
$node = node_load(array('nid' => arg(1)));
?>
<ul>
<li <?php if ($node->nid == "178") {echo "class=\"buttonactive\""; }?>><a href="/node/178">General Pathology</a></li>
<li <?php if ($node->nid == "187") {echo "class=\"buttonactive\""; }?>><a href="/node/187">Clinical Pathology</a></li>
<li <?php if ($node->nid == "307") {echo "class=\"buttonactive\""; }?>><a href="/node/307">Surgical and Cytopathology</a></li>
<li <?php if ($node->nid == "295") {echo "class=\"buttonactive\""; }?>><a href="/node/295">Dermatopathology</a></li>
<li <?php if ($node->nid == "183") {echo "class=\"buttonactive\""; }?>><a href="/node/183">Basic Sciences</a></li>
<li <?php if ($node->nid == "184") {echo "class=\"buttonactive\""; }?>><a href="/node/184">Medical Informatics</a></li>
<li <?php if ($node->nid == "308") {echo "class=\"buttonactive\""; }?>><a href="/node/308">Neuropathology</a></li>
<li <?php if ($node->nid == "309") {echo "class=\"buttonactive\""; }?>><a href="/node/309">Hematopathology</a></li>
</ul>
The problem is that I now find that Panels aren't classified nodes at all, and consequently do not have node IDs. Does anyone know an equivalent function I could use to identify the Panel (perhaps based on its path alias)? Thanks for any info you might have on this.
Kenny
Comments
Each panel has a URL that you could test for
Each panel has a URL that you could test for, so something like this would work
thanks
Thanks, that works!