Created
September 26, 2011 18:47
-
-
Save greggles/1243016 to your computer and use it in GitHub Desktop.
1290624_example1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function example_module_menu() { | |
$items['example-search-callback'] = array( | |
'title' => t('Node search'), | |
'page callback' => 'example_module_callback', | |
'access callback' => TRUE, | |
'type' => MENU_CALLBACK | |
); | |
return $items; | |
} | |
function example_module_callback() { | |
$output = ''; | |
$search = $_GET['search_keyword']; | |
$results = db_query("SELECT nid, title FROM {node} WHERE title like '%%$search%%';") | |
while ($node = db_fetch_object($results)) { | |
$output .= '<a href="/node/'. $node->nid .'">'. $node->title .'</a>'; | |
} | |
return $output; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment