[TYPO3-dev] RealUrl #13475: userFunc an Bypass or: Add possibility to userFuncs to bypass the param as known from valueMap
Christian Ludwig
cl at viazenetti.de
Mon Feb 25 20:42:36 CET 2013
Hi,
> Solution:
> change line 1344 to:
> $params = array('pObj' => &$this, 'value' => $value, 'decodeAlias' =>
> TRUE, 'pathParts' => &$pathParts, 'origValue' => $origValue);
has this feature been implemented in RealURL?
I am hitting exactly the same problem here and don't know how to get
things running.
This configuration did what I want to do but I need to use a userFunc
because the values to map must be fetched by a webservice.
'preVars' => array (
array (
'GETvar' => 'tx_myext[id]',
'valueMap' => array (
'robert' => 1,
'christina' => 2,
'peter' => 3,
),
'noMatch' => 'bypass',
),
),
So I changed it to this:
------
'preVars' => array (
array (
'GETvar' => 'tx_myext[id]',
'userFunc' => 'EXT:myext/real_url.php:&tx_myext ->main,
'noMatch' => 'bypass',
),
),
------
public function main($params, $ref) {
$valueMap = array (
'robert' => 1,
'christina' => 2,
'peter' => 3,
);
if ($params['decodeAlias']) {
if (isset($valueMap[$params['value']])) {
return $valueMap[$params['value']];
}
}
else {
$alias = array_search($params['value'], $valueMap);
if ($alias !== false) {
return $alias;
}
}
return null;
}
------
Now the problem is that I always get the 'emptySegmentValue' = 'nothing'
as the first path segment when there is no hit
(http://me.com/nothing/page instead of http://me.com/page). When I do
not set 'emptySegmentValue', I end up in seeing the startpage (links are
rendered as wished to http://me.com/page but pare output is like
http://me.com/) until I add the desired page alias as the second segment
(http://me.com/page/page).
What is the right way to let my userFunc exactly do the same as
'noMatch' => 'bypass' does? Using
array_unshift($params['pathParts'],$params['origValue']); before my
return null; statement did not change anything.
Thanks.
Regards
Christian
More information about the TYPO3-dev
mailing list