Posted by philbar on November 16, 2010 at 6:35pm
I can't for the life of my figure out how to use the menu_valid_path.
I'm creating a dynamic navigation block and would like to check that paths exist before displaying links.
<?php
$path = '/industrial/odor-control/description';
if menu_valid_path($path){
print '<li><a href="'. $path .'"><span class=\"tab\">Description</span></a></li>'
}
?>What am I doing wrong? Does this function not work in blocks? Am I using the function wrong?
All I get is this parse error:
Parse error: syntax error, unexpected T_STRING, expecting '(' in /home/bioworld/public_html/includes/common.inc(1695) : eval()'d code on line 23
Comments
Looks like you're missing
Looks like you're missing parentheses on your if statement, should be
if(menu_valid_path($path)) {
and also need a semicolon at the end of the print statement
Thanks! I've contributed my
Thanks!
I've contributed my code example to the documentation:
http://api.drupal.org/api/drupal/includes--menu.inc/function/menu_valid_...