Hey there, this module is great! If I can manage to fix some issues like automatically tagging content for MLT then I could really use this on a large scale project!!

Anyways, I was wondering if it's possible to change the results for the BOSS search results? For example, I would like to remove the date and maybe provide a small sentence below the link to describe the link. Is this possible by using this module, or we would be better to actually integrate with the BOSS API directly?

Thanks a lot,

Patchak

Comments

febbraro’s picture

Assigned: Unassigned » febbraro

Hey Patchak,

All MLT results are completely theme-able. For Yahoo BOSS News/Web search, for example, these are the default theme functions (as of v 1.1):

/**
 * Theme an individual morelikethis item.
 *
 * @param $item
 *    An More Like This object for the provided node.
 */
function theme_morelikethis_yboss_item($item) {
  return theme("morelikethis_yboss_{$item->yboss_type}_item", $item);
}

/**
 * Theme an individual morelikethis web item.
 *
 * @param $item
 *    An More Like This object for the provided node.
 */
function theme_morelikethis_yboss_web_item($item) {
  return l("$item->title ($item->date)", $item->clickurl);
}

/**
 * Theme an individual morelikethis news item.
 *
 * @param $item
 *    An More Like This object for the provided node.
 */
function theme_morelikethis_yboss_news_item($item) {
  $output = l("$item->title", $item->clickurl);
  $output .= ' - (' . l("$item->source", $item->sourceurl) . ')';
  return $output;
}

Those are just for the individual items, so in order to change it you can implement [themename]_moreliekthis_yboss_item or [themename]_morelikethis_yboss_web_item and do whatever you like.

Further, if you want to theme the overall structure of the block you can implement [themename]_morelikethis_yboss_block.

Hope that helps.

patchak’s picture

Wow this is great!!

Hummm kinda newbie question : how can I see all the variables available to me in this function? I need to do like "print_r($item)" in my theme override to get to see it? Is there a place where I could see a list??

thanks,
Patchak

febbraro’s picture

Status: Active » Closed (won't fix)

Yes you can use print_r or var_dump.

Another thing I like to do is install the devel module and use the

dpm($item);

Good luck.

patchak’s picture

Hummm here is the theme function I have now :

/**
 * Theme an individual morelikethis web item.
 *
 * @param $item
 *    An More Like This object for the provided node.
 */
function theme_morelikethis_yboss_web_item($item) {
var_dump($item);
  return l("$item->title ($item->date)", $item->clickurl);
  print '<br />' . $item->teaser;
}

/**
 * Theme an individual morelikethis news item.
 *
 * @param $item
 *    An More Like This object for the provided node.
 */
function theme_morelikethis_yboss_news_item($item) {
  $output = l("$item->title", $item->clickurl);
  $output .= ' - (' . l("$item->source", $item->sourceurl) . ')';
  $output .= '<br />' . $item->teaser;
  return $output;
}

I added some code to print the "$item->teaser; " element, but I can't see any change when I refresh my pages. i tried resaving the node, emptying the cache, but no luck at all!

Any advice?
thanks,

Patchak

febbraro’s picture

If those functions are defined in your theme's template.php file then you need to change [theme] to the actual name of your theme. Then you need to clear all caches (as the theme registry is cached).

Good luck