Thursday, 16 December 2010

drupal view argument as node id

So your url might be “news/jan/drupal-is-eight” but the “true” url is still node/NID.
To get the nid you can use the arg function like so:
<?php//check we are on a node page firstif (arg(0) && is_numeric(arg(1))) {
 
$nid = arg(1);
}
?>

No comments:

Post a Comment

Source base installation of php, mysql and apache in ubuntu/ linux

Compile and Install a LAMP(Linux/Apache/MySQL/PHP) Server from Source In the last post, I described the method to install a LAMP ser...