Theming?
doomed - December 4, 2008 - 02:46
| Project: | Autocomplete Node Finder |
| Version: | 5.x-3.4 |
| Component: | Miscellaneous |
| Category: | support request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Jump to:
Description
Hello,
I started using this module just now and I have some questions:
1. I Noticed the results page is really bland.
It's ignoring the sites' theme completely and the results just come on a white page.
Is this the correct behaviour and we're supposed to theme it? If so, where do i start?
2. The screenshots show results coming up with embedded pictures, how can we do this?

#1
1. I think this might be related to a bug - it's doing 'print' page instead of 'return' page. Although I don't have the 'white page' problem myself it could be related. I will get onto this soon. I've mostly been working with the drupal 6 version, so some of the fixed bugs haven't been fixed in the drupal 5 version.
2. That's a theme function you have to override. Example is in the default theme function in the code. See also http://drupal.org/node/313807 for more info.
#2
On the bug thing
I'm using http://drupal.org/project/ad_redoable theme if that helps.
#3
Please try to latest version. I have tested it and it seems to work. If it's still broken reopen this issue.
#4
I have tested the new v5.3.7 and the white page bug does not happen anymore.
Thanks for the prompt fix.
#5
> 2. That's a theme function you have to override.
> Example is in the default theme function in the
> code. See also http://drupal.org/node/313807 for more info.
Well, i have tried changing the suggestion box by doing this - http://drupal.org/node/313807#comment-1054436 .
Its working but its just the same results page loading on a much smaller area. So its very ugly and not usable at all, which brings me to the start of my problem... How to theme these things?
Would you be willing to give step by step instructions on how to do something like this - http://drupal.org/node/319970 ?
I'm pretty sure this would help a lot of people using the module in a more "fashionable" way..
#6
Daniel, i have a different question..
I already modified my theme's template.php in order to change the way Search module (core) shows its results.
Just a simple modification that goes like this:
function phptemplate_search_item($item, $type) {
$output = ' <dt class="title"><a href="'. check_url($item['link']) .'">'. check_plain($item['title']) .'</a></dt>';
$info = array();
if ($item['type']) {
$info[] = check_plain($item['type']);
}
/*if ($item['user']) {
$info[] = $item['user'];
}
if ($item['date']) {
$info[] = format_date($item['date'], 'small');
}*/
if (is_array($item['extra'])) {
$info = array_merge($info, $item['extra']);
}
$output .= ' <dd>'. ($item['snippet'] ? '<p>'. $item['snippet'] .'</p>' : '') .'<p class="search-info">'. implode(' - ', $info) .'</p></dd>';
return $output;
}
How would i apply the same kind of code to the search results presented by Autocomplete Node Finder?
The results function in there is totally different.
#7
you've lost me, you're talking about 3 different things ?
- The picture you linked to is not a results page, it is the autocomplete suggestions
- The search module has nothing to do with this and you will not be able to reuse code
- to theme results override theme_autocomplete_node_finder_results_page, and interest yourself with the line: $output .= node_view($result, TRUE); which is the code to do a node teaser.
- to theme suggestions override theme_autocomplete_node_finder_suggestion, check the commented code for an example of doing a node teaser.
- Check that thread for CSS tips on how to style the teasers to not look spastic in the suggestion box
#8
Hah, sorry for any confusion. But i did create different posts.
There are two issues here.
1st) Theming the suggestions box ( http://drupal.org/node/342464#comment-1140342 )
I tried this quickly and i have changed my idea on this. I wont do this, i'll stay with the simple text suggestions for now.
2nd) Theming the results page ( http://drupal.org/node/342464#comment-1140477 )
This is what i need to change.
I want the results to be simple, showing only these fields:
Node title
content type
#9
- to theme results override theme_autocomplete_node_finder_results_page, and interest yourself with the line: $output .= node_view($result, TRUE); which is the code to do a node teaser.
So you would need something like
$output .= "<h3>".$result->title ."</h3><div>". $result->type . "</div>";#10
Thanks danielb.
This is working and i've adapted it to include a couple more fields.
But there's something that i dont seem to be able to show, which is the Taxonomy terms, because its an array.
I admit my knowledge is quite limited in these things. Can you help?
#11
Sorry mate, not really my area. If you want to be creative with theming then you should really join a theming community, like on the forums, irc, groups, etc... as they are more interested in doing that stuff.
#12
No problem, thanks for your support.
#13
''Would you be willing to give step by step instructions on how to do something like this - http://drupal.org/node/319970 ?''
I agree with you... all of the users of A.N.F need something like that...
#14
Automatically closed -- issue fixed for two weeks with no activity.
#15
I was looking to have the results page come back with the just the node title that links the node.
Here's the modification I made to get this.
$output .= "<h3><a href=node/$result->nid>".$result->title ."</a></h3>";Is there a better (cleaner, more elegant) way to do this?