Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $url = 'about-us';
- $path = drupal_lookup_path('source', $url);
- if ($path) {
- $node = menu_get_object('node', 1, $path);
- return $node->nid;
- }
- else {
- //Error handling in case path provided does not exist
- }
- $argument_one = arg(0); // This will store "node" to the variable.
- $node_id = arg(1); // This will store 100 to $node_id variable.
- $URL = $_SERVER['REQUEST_URI'];
- OR
- $URL = $_GET['q']
- // if using this then the full path needs prepending as this only gets node/nid
- OR
- $URL = current_path(); // same as GET[q] basically
- // then this passes to that function you wanted
- $nid = getNodeId($URL);
- $nid = end(arg()); // Get the last number from the URL.
- $url_arr = explode('/', $url);
- <?php
- $nodeid = $node->nid;
- ?>
- <a href="http://www.mysite.com?nodeid="<? php print ($nodeid) ?>">
- <?php
- $nodeid=$_GET["nodeid"];
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement