I have been working with CMSMS MLE for a client, and I wanted multi-lingual functionality in the search module. While I was at it, I enabled it to display a snippet of the page's content in the appropriate language. While I'm only using two languages (English and Spanish) this example may be useful to someone else. With the example, you will need to find the appropriate place in the code and enter the changes.
I'm using the Search module (version 1.5)
action.dosearch.php
------------------------------------------------------------------------------------------------------------------------
line 81
$content =& $node->GetContent();
if (isset($content))
{
if($_GET['hl']=="es_MX")
{
$pageContent = $content->GetPropertyValue("content_es");
}
else
{
$pageContent = $content->GetPropertyValue("content_en");
}
$col->AddItem($content->Name(), $content->GetURL(), $pageContent, $result->fields['total_weight']);
}
------------------------------------------------------------------------------------------------------------------------
line 231 (close enough)
foreach( $results as $result )
{
$title = $result->title;
$txt = $result->urltxt;
$txt = strip_tags($txt);
$txt = substr($txt, 0, 300);
foreach( $words as $word )
{
$title = preg_replace('/('.$word.')/i', '$1', $title);
$txt = preg_replace('/('.$word.')/i', '$1', $txt);
}
$result->title = $title;
$result->urltxt = $txt;
$newresults[] = $result;
}
------------------------------------------------------------------------------------------------------------------------
Result Template:
{if ($parent_lang=="en")}{$searchresultsfor}{else}Resultados de búsqueda para{/if} "{$phrase}"
{if $itemcount > 0}
{foreach from=$results item=entry}
url}">{$entry->title}
{$entry->urltxt}[...]
url}">{$entry->url}
Read more...
{/foreach}
{$timetaken}: {$timetook}-->
{else}
{$noresultsfound}
{/if}
------------------------------------------------------------------------------------------------------------------------
Tell me what you think!
Search function modifications
Search function modifications
Last edited by flyingbuttressman on Wed Jan 21, 2009 8:05 pm, edited 1 time in total.
Re: Search function modifications
Hey, looks very good, flyingbuttressman!! 
But a changed file could be overwritten with an upgrade. You will lose the changes...
Perhaps you could suggest this as a future request at the Forge. [ http://dev.cmsmadesimple.org/ ]
Even though, very nice! Keep going
Rolf

But a changed file could be overwritten with an upgrade. You will lose the changes...
Perhaps you could suggest this as a future request at the Forge. [ http://dev.cmsmadesimple.org/ ]
Even though, very nice! Keep going

Rolf
- + - + - + - + - + - + -
LATEST TUTORIAL AT CMS CAN BE SIMPLE:
Migrating Company Directory module to LISE
Migrating Company Directory module to LISE
- + - + - + - + - + - + -
Re: Search function modifications
I had misunderstanding.flyingbuttressman wrote: I have been working with CMSMS MLE for a client, and I wanted multi-lingual functionality in the search module.
For changing labels use {..... lang=$lang} in your tag and/or use $mle_translation.key
Alby