[TYPO3-dev] Extending news_author_rel: a typo3 and SQL question

Ingmar Schlecht ingmar at typo3.org
Sat Mar 25 16:43:54 CET 2006


Hi Pieter,

Pieter wrote:
> My questions:
> 1) how can I access the typoscript configuration in ext_tables.php?  I
> need to replace "5" with a typoscript value.

There is no standard way to access typoscript values in the backend,
except for building the whole TypoScript tree manually in the backend as
e.g. the rlmp_automaketemplate extensions does.

But you can't use TypoScript here anyway, because in ext_tables.php you
don't know for which page ID you should generate the Template TypoScript
tree.

> 2) I need to look for "1,7,15" in the fe_users.usergroup field and
> FIND_IN_SET will not do that for me.  Is there a SQL command to look for
> items from a comma-separated list in an other comma-separated list?

Try this:

<?php

define('PATH_t3lib', dirname(__FILE__).'/quick/t3lib/');

require_once(PATH_t3lib.'class.t3lib_div.php');

function findInSet_whereClause($field,$list,$mode="AND") {
	$items = t3lib_div::trimExplode(',',$list);
	foreach($items as $item) {
		$whereClause .= $mode." (
			$field = '$item' OR
			$field LIKE '$item,%' OR
			$field LIKE '%,$item' OR
			$field LIKE '%,$item,%'
		) ";
	}
	return $whereClause;
}

echo findInSet_whereClause('fe_users.group','1,7,15','OR');

?>

cheers,
Ingmar




More information about the TYPO3-dev mailing list