CMS MADE SIMPLE FORGE

News Module

 

[#3841] Better integration of the Search Module

avatar
Created By: Mourad Louha (maninweb)
Date Submitted: 2009-08-05 04:48

Assigned To:
Resolution: Fixed
State: Closed
Summary:
Better integration of the Search Module
Detailed Description:
Hi there,

my first post here :-) Cyberman, a mod in the german subforum told me, it may be
a good idea to post an improvement idea for the news module here (Original
Thread in German http://forum.cmsmadesimple.org/index.php/topic,32495.0.html)

Well, the search module can take some params by using this syntax:
"passtru_MODULENAME_PARAMNAME='value'" for example
"passthru_News_detailpage='newsdetails"

For this a function is needed in the News Module. I did it on my site and it
works there. Here the code

// Modul : News
// Version : 2.83
// Datei : modules/News/News.module.php
// Änderungen : Neue Funktion hinzugefügt, nach der Funktion SearchResult(...)


function SearchResultWithParams($returnid, $articleid, $attr = '', $params =
'')
	{
		$result = array();
	
		if ($attr == 'article')
		{
			$db =& $this->GetDb();
$q = "SELECT news_title FROM ".cms_db_prefix()."module_news WHERE news_id =
?";
			$dbresult = $db->Execute( $q, array( $articleid ) );
			
			if ($dbresult)
			{
				$row = $dbresult->FetchRow();
				
				//0 position is the prefix displayed in the list results.
				$result[0] = $this->GetFriendlyName();
				
				//1 position is the title
				$result[1] = $row['news_title'];
				
				//2 position is the URL to the title.
				
				$aliased_title = munge_string_to_url($row['news_title']);
				$prettyurl = 'news/' . $articleid.'/'.$returnid."/$aliased_title";
				$miwdata = array('articleid' => $articleid);
				
				foreach ($params as $key => $value)
				{
					$miwdata[$key] = $value;
				}
				
$result[2] = $this->CreateLink('cntnt01', 'detail', $returnid, '', $miwdata
,'', true, false, '', true, $prettyurl);
			}
		}
		
		return $result;
	}

Perhaps this may be checked and integrated in a next release of the CMS.

Regard from Germany

PS: The textbox here to post is a little bit small.

History

Updates

Updated: 2015-04-21 21:05
state: Open => Closed

Updated: 2013-08-22 16:31
resolution_id: => 7