Is there a way to search drupal for a specific node id?

Comments

mooffie’s picture

Let's assume the node ID is 9667.

You simple navigate to the 'http://drupal.org/node/9667' URL.

teejayuu’s picture

Thanks moofie, I didn't explain myself properly. I have a block that contains a search form

<form action="search.php" method="post">
  <input type="text" name="NodeIdSearch" value="Enter node id..." /><input type="submit" value="Search" />
</form>

and a View that when the user enters an id - say 9667 I want the view to return www.example.com/node/9667. The views URL is 'search/$arg'

balrog77’s picture

Hi All

I have the same need. I just want a "Search" block that when someone enters the node id, Drupal will go to the "www.yoursite.com/node/nid" URL, where the nid in the URL is the node ID the person entered.

I can't see that it can be very difficult, but I am stumped.

Any help will be VERY welcome! :-)

balrog77’s picture

Just in case anybody else runs across this problem, I got it resolved.

The solution is:
1 - Download and install the Webform module from here: http://drupal.org/handbook/modules/webform
2 - Read up on the URL redirection here: http://drupal.org/node/257100

If you are then interested in adding this functionality to a Block, copy the following into the Block body (with PHP enabled):

<?php
$node = node_load(42);
$node->title = NULL;
print node_view($node);
?>

Just change the "42" above into the relevant node for your site...
If you want the Title, remove the "$node->title = NULL;".

Implemented for www.prorealty.co.za

I hope somebody else can find this useful..