Skip to content
This repository has been archived by the owner on Nov 19, 2021. It is now read-only.

use more than one snippet calls on the page #12

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -9,6 +9,10 @@
$mSearch = $modx->getService('msearch','mSearch',$modx->getOption('core_path').'components/msearch/model/msearch/',$scriptProperties);
if (!($mSearch instanceof mSearch)) return '';

//reconfigurate mSearch
if($reconfig==1)
$mSearch->reconfigurate($scriptProperties);

// Обрабатываем поисковый запрос
if (isset($_REQUEST[$queryVar])) {
$query = trim(strip_tags($_REQUEST[$queryVar]));
@@ -100,4 +104,4 @@
return;
}
return implode($outputSeparator, $result);
}
}
10 changes: 8 additions & 2 deletions core/components/msearch/model/msearch/msearch.class.php
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@ function __construct(modX &$modx,array $config = array()) {
$assetsUrl = $this->modx->getOption('msearch.assets_url',$config,$this->modx->getOption('assets_url').'components/msearch/');
$connectorUrl = $assetsUrl.'connector.php';

$this->config = array_merge(array(
$this->config = array(
'assetsUrl' => $assetsUrl
,'cssUrl' => $assetsUrl.'css/'
,'jsUrl' => $assetsUrl.'js/'
@@ -31,8 +31,14 @@ function __construct(modX &$modx,array $config = array()) {
,'morphy_lang' => $this->modx->getOption('msearch.lang')
,'morphy_storage' => 'mem'
,'disablePhpMorphy' => false
),$config);
);
$this->reconfigurate($config);

}

public function reconfigurate(array $config = array()) {
$this->config = array_merge($this->config,$config);

if (isset($this->config['sortFilters'])) {$this->config['sortFilters'] = explode(',', $this->config['sortFilters']);}

$this->modx->addPackage('msearch',$this->config['modelPath'], $this->modx->config['table_prefix'].'mse_');