[TYPO3-dev] Some minor problems with fetching from database

Erik Svendsen erik at linnearad.no
Thu Jun 18 16:31:25 CEST 2009


I'm working on an extensions which when clicking on the correct letter 
in an alphabetical list fetch the records which title are starting with 
that letter. 99,5 % of the extension is working, but I have one problem. 
Probably because this extension has to work with Northern Sami.

Clicking on a letter produces a variable like this.
&extension_code[achar]=Á

The "achar" value is correct for all letters. And except for letters A 
and Á everything works correct. But for both A and Á I'm getting records 
starting with both this letters. Clicking on A gives
	Alit (blue)
         Árran (fireplace)

same results clicking on Á.

The code looks like this.

/**** code ****/
$curChar = 
empty($this->piVars['achar'])?$defaultChar:(addslashes($this->piVars['achar']));

// $curChar gives correct value

if ($curChar != '0-9') {
    $wherePage = '(exttitle LIKE \''.$curChar.'%\'';
}
     else {
     $wherePage = '(exttitle LIKE \'0%\'';
     for ($i=1;$i<10;$i++) {
	$wherePage .= ' OR exttitle like \''.$i.'%\'';
     }
}

$wherePage .= ') AND 1 = 1';

$content = '';

$selectConf = array();
		
$selectConf = $this->myObj->getSelectConf($wherePage);
$selectConf['selectFields'] = 'DISTINCT ext_table.uid, ext_table.pid, 
ext_table.exttitle, ext_table.text;
$selectConf['orderBy'] = 'ext_table.exttitle';

$res = $this->cObj->exec_getQuery('ext_table', $selectConf);

// more code to fill markers and so on.

/**** code end ****/

I'm pretty sure the code is correct, as it works as it should except for 
to letters. But the problem with A and Á is annoying me.

Someone more experienced than me who has any nice trick or better ways 
to do it.

Thanks!

Regards

Erik Svendsen.




More information about the TYPO3-dev mailing list