| Author |
Message |
|
Hoernerice
Level 1 (57 %)
Posts: 5 |
ID #408
Ich hab versucht die Fkt. displaySearch so zu ändern das der PageBrowser für die Suche funktioniert. Leider nur mit leidlcihem erfolg. das "limit" funktioniert, aber wenn ich die nächste seit anclick is die seite leer.
hier ma mein gepfusche aus der class.tx_mhbranchenbuch_pi1.php (zeile ~345)^^
Language: Text /* PAGEBROWSER INIT */
$enableFields = $this->cObj->enableFields($this->dbTable1);
$res_c = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
'uid',
$this->dbTable1,
'`pid` IN(' . intval($pid) . ') ' . $query . ' ' . $enableFields
);
$count = $GLOBALS['TYPO3_DB']->sql_num_rows($res_c);
if (!isset($this->piVars['page'])) $this->piVars['page'] = 0;
$limit = $this->piVars['page'] * $this->resultsPerPage . "," . $this->resultsPerPage;
$pageBrowser = array(
'pid' => $pid,
'limit' => $limit,
'page' => $this->piVars['page'],
'table' => $this->dbTable1,
'count' => $count,
);
//michse
$res = $GLOBALS['TYPO3_DB']->sql(TYPO3_db,"
SELECT
f.*,
k.name AS category
FROM
" . $this->dbTable1 . " f
JOIN " . $this->dbTable2 . " k ON k.uid = f.kategorie
WHERE
f.pid IN (" . intval($pid) . ")
" . $query . "
ORDER BY
f.firma ASC
LIMIT " . $limit . "
");
This Post was edited 6 times so far, last change on 27. May 10
|
27.05.10, 21:46 |
|
|
Martin Hesse
Level 10 (63 %)
Posts: 203 |
ID #409
Hi,
das sieht schonmal garnicht übel aus. Wo weist du den den Pagebrowser dem Content zu? Du musst schauen das du die Werte mit übergibst, d.h das Schlüsselwort, wonach gesucht wird usw.
Gruß,
Martin
|
28.05.10, 19:33 |
|
|
Hoernerice
Level 1 (57 %)
Posts: 5 |
ID #416
Das so bischen mein problem. reicht da, das array um 'keyword' => $keyword1 zu erweitern?
|
29.05.10, 15:02 |
|
|
Hoernerice
Level 1 (57 %)
Posts: 5 |
ID #417
Ich hab am anfang folgendes versucht:
Language: Text if(!isset($this->piVars['keyword1']) || !isset($this->piVars['keyword2']))
{
$keyword1 = t3lib_div::_GP('keyword');
$keyword2 = t3lib_div::_GP('keyword2');
$this->piVars['keyword1'] = $keyword1;
$this->piVars['keyword2'] = $keyword2;
}
else
{
if(isset($this->piVars['keyword1']))
{
$keyword1 = $this->piVars['keyword1'];
}
else if(isset($this->piVars['keyword2']))
{
$keyword2 = $this->piVars['keyword2'];
}
else
{
$keyword1 = $this->piVars['keyword1'];
$keyword2 = $this->piVars['keyword2'];
}
}
leider hat das nur das ergebnis, das auf der suchseite die ersten 10treffer angezeigt werden, wenn ich nun weiter klick um auf die nächste seite zu kommen ist diese leider wieder leer und der link hat sich zu /suchergebnis/1.html?tx_mhbranchenbuch_pi1[keyword2]=esslingen geändert
NACHTRAG:
Ich hab festgestellt, das es Funktioniert wenn man 2 suchwörter eingibt. also eines in das Wer/Was feld und eines in das Wo feld. wenn man nur eines der beiden verwendet fkt. es nicht.
This Post was edited 2 times so far, last change on 29. May 10
|
29.05.10, 15:46 |
|
|
Hoernerice
Level 1 (57 %)
Posts: 5 |
ID #418
^^ *rotwird*
macht in dem ersten if aus dem || ein && und es tut ^^
|
29.05.10, 18:38 |
|
|
Hoernerice
Level 1 (57 %)
Posts: 5 |
ID #419
der vollständigkeitshalber die fertige komplette displaySearch() (noch eine kleinigkeit geändert das au richtig tut wies soll ^^):
Language: Text function displaySearch($pid) {
$markerArray = array();
$wrappedSubpartArray = array();
if(!isset($this->piVars['keyword1']) && !isset($this->piVars['keyword2']))
{
$keyword1 = t3lib_div::_GP('keyword');
$keyword2 = t3lib_div::_GP('keyword2');
$this->piVars['keyword1'] = $keyword1;
$this->piVars['keyword2'] = $keyword2;
}
else
{
if(isset($this->piVars['keyword1']) && !isset($this->piVars['keyword2']))
{
$keyword1 = $this->piVars['keyword1'];
//$keyword2 = "";
}
else if(!isset($this->piVars['keyword1']) && isset($this->piVars['keyword2']))
{
//$keyword1 = "";
$keyword2 = $this->piVars['keyword2'];
}
else
{
$keyword1 = $this->piVars['keyword1'];
$keyword2 = $this->piVars['keyword2'];
}
}
$selectBox = t3lib_div::_GP('tx_mh_branchenbuch_postVar');
$bundesland = $this->piVars['bid'];
$landkreis = $this->piVars['lid'];
$ort = $this->piVars['oid'];
$query = FALSE; #init
// Some language
$markerArray['###LANG_SEARCH_WHO###'] = $this->pi_getLL('search_who');
$markerArray['###LANG_SEARCH_WHERE###'] = $this->pi_getLL('search_where');
$markerArray['###LANG_SEARCH_SUBMIT###'] = $this->pi_getLL('search_submit');
// Show number of results
$markerArray['###MENGE###'] = $this->pi_getLL('search_number_of');
$template = $this->cObj->getSubpart($this->template,"###SEARCHBOX###");
$minLengthKeyword1 = $this->minLengthKeyword1 ? $this->minLengthKeyword1 : 3;
$minLengthKeyword2 = $this->minLengthKeyword2 ? $this->minLengthKeyword2 : 3;
if($keyword1 != "" && $keyword1 != "%" && strlen(trim($keyword1)) >= $minLengthKeyword1) {
$query .= ' AND ';
$query .= $this->getSearchResultsKeyword1($keyword1);
}
if($keyword2 != "" && $keyword2 != "%" && strlen(trim($keyword2)) >= $minLengthKeyword2) {
$query .= $this->getSearchResultsKeyword2($keyword2);
}
if($query) {
/* PAGEBROWSER INIT */
$enableFields = $this->cObj->enableFields($this->dbTable1);
$res_c = $GLOBALS['TYPO3_DB']->sql(TYPO3_db,"
SELECT
f.*,
k.name AS category
FROM
" . $this->dbTable1 . " f
JOIN " . $this->dbTable2 . " k ON k.uid = f.kategorie
WHERE
f.pid IN (" . intval($pid) . ")
" . $query . "
ORDER BY
f.firma ASC
");
$count = $GLOBALS['TYPO3_DB']->sql_num_rows($res_c);
if (!isset($this->piVars['page'])) $this->piVars['page'] = 0;
$limit = $this->piVars['page'] * $this->resultsPerPage . "," . $this->resultsPerPage;
$pageBrowser = array(
'pid' => $pid,
'limit' => $limit,
'page' => $this->piVars['page'],
'table' => $this->dbTable1,
'count' => $count,
);
//michse
$res = $GLOBALS['TYPO3_DB']->sql(TYPO3_db,"
SELECT
f.*,
k.name AS category
FROM
" . $this->dbTable1 . " f
JOIN " . $this->dbTable2 . " k ON k.uid = f.kategorie
WHERE
f.pid IN (" . intval($pid) . ")
" . $query . "
ORDER BY
f.firma ASC
LIMIT " . $limit . "
");
if($GLOBALS['TYPO3_DB']->sql_num_rows($res_c)) {
//$markerArray['###MENGE###'] = 'Anzahl der Einträge: '.$GLOBALS['TYPO3_DB']->sql_num_rows($res);
$markerArray['###MENGE###'] = 'Anzahl der Einträge: '.$count;
$markerArray['###SEARCHRESULT###'] = $this->getItem($res,TRUE,'',$pageBrowser);
}
else
{
$markerArray['###SEARCHRESULT###'] = $this->pi_getLL('search_not_found');
}
}
btw. kann ich dem "code" kein farbhighlighting verpassen?
This Post was edited 3 times so far, last change on 29. May 10
|
29.05.10, 19:52 |
|
| Register or login to reply |
|