Node path to path alias array

Convert Drupal node path, "node/123.." to path alias and store it in an array. Useful when you have conditions based on path alias in your module or template files.

<?php
 
//Get path alias from arg() function and back to array
 
$path = implode('/',arg());
 
$path_alias = drupal_get_path_alias($path);
 
$arg = explode('/', $path_alias);

 
$show_path = array("knowledgebase", "knowledge", "search", "convert", "extract", "password");
 
  if (
in_array($arg[0], $show_path)) {
    
//Do something...
 
}

?>
Knowledge keywords: