I want to show some extra book information in the search result page like node id, book id, book name etc. I have added some code in search-result.tpl.php but its still not showing.

$node->book['bid']  //is added to show book id.
$node->node['nid'] //is added to show node id.

Let me know where i am doing wrong.


Finally managed it using search-result.tpl.php file which copied in theme folder.

 $url = $variables['result']['fields']['url']; 

this variable gives search result urls from which i extracted book name and based in book name i printed book id. @Anil, thanks for the help which guide me at right direction and got to know many more.

| improve this answer | |

Please find the full documentation regarding search-result.tpl.php .

Above documentation explains full node information is stored in $result. You can able to pull information like Node Id, Book Id, Book Name using $result variable. Use below code to print out $result variable in tpl file which you can override in your custom theme.

print '<pre>';
print '</pre>';
| improve this answer | |
  • I tried using $result but i am unable to get the book id and book name in it. Will you please tell how can i get the book name. – Akshay Sawant Feb 10 '14 at 9:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.