[TYPO3-ttnews] realurl, news selection of 2 categories
bernd wilke
t3ng at bernd-wilke.net
Fri Jun 20 08:25:04 CEST 2014
Am 19.06.14 09:45, schrieb Muriel le Pair:
> Hi,
>
> bernd wilke schreef op 18-06-14 17:18:
>> now you have two categories in the parameter - which can not be resolved
>> automaticaly (or you need a much more complex logic).
>> you might hardcode your category pairs if there are just a few.
>> But your example has an ID 31, that would be a very big matrix.
>
> Yeah hardcoding isn't an option.
> To make it even more complex: sometimes there are 2 categories,
> sometimes just 1 (on other pages).
>
> So if only I would be able to add a static id to the
> tx_news_pi1[overwriteDemand][categories] before the query is performed
> that would do the trick.
>
> Something like: tx_news_pi1.settings.overWriteDemand.categories = 31, +
> (parameter send in get string).
>
> Is this possible?
I don't think so, as realurl translates the complete parameter or
nothing. your attempt would give you two parameters with same name.
(you might include my ext:pageparams to see what URL other extensions
see: just an array of parameters and no pathes)
>> maybe a little bit PHP with two cascaded loops in the php-version of
>> realurl_conf.php ?
if you include realurl_conf.php in the plain-PHP way you see it is just
a building of an array. this array can be build up static or with a
little programming logic.
maybe this could be your solution:
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['realurl'] = array (
'_DEFAULT' => array (
:
)
);
$categoryNames = array(
1 => 'cat1',
5 => 'cat2',
:
50 => 'cat20',
);
$valueMap = array();
foreach ($categorynames as $catKey => $catVal) {
$valueMap[$catVal] = $catkey;
foreach ($categorynames as $catKey2 => $catVal2) {
$valueMap[$catVal . ',' . $catVal2] = $catkey . ',' . $catkey2;
}
}
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['realurl']['_DEFAULT']['preVars'][5]
= array(
'Getvar' => 'tx_news_pi1[overwriteDemand][categories]',
'valueMap' => $valueMap,
#'valueDefault' => 'cat1',
'noMatch' => 'bypass',
);
?>
maybe you get the category names from database,
maybe you generate the 'static' array outside from TYPO3 and write a
array dump to be included (for performance gains)
bernd
--
http://www.pi-phi.de/cheatsheet.html
More information about the TYPO3-project-tt-news
mailing list