Пропустить контроллер и действие при генерации URL

Версия TYPO3 7.6.0.

Создать ссылку:

<f:link.action action="single" class="title" pageUid="{settings.pidDetails}" additionalParams="{unid: '{unid}'}" noCacheHash="true">Link text</f:link.action>

Результат:

http://example.com/property/flats/?unid=12345&tx_ext_extp1%5Baction%5D=single&tx_ext_extyp1%5Bcontroller%5D=Ext

Нужно: пропустить контроллер и действие при генерации URL - http://example.com/property/flats/?unid=12345


person user189535    schedule 15.12.2015    source источник
comment
Посмотрите на этот ответ   -  person sascha.seyfert    schedule 16.12.2015


Ответы (2)


Вы можете использовать расширение realurl для чистого URL. После установки отредактируйте файл realurl_autoconf.php, который находится в папке typo3conf.

function user_encodeSpURL_postProc(&$params, &$ref) {
    $params['URL'] = str_replace('blog/post/article/', 'blog/post/', $params['URL']);
}
function user_decodeSpURL_preProc(&$params, &$ref) {
    $params['URL'] = str_replace('blog/post/', 'blog/post/article/', $params['URL']);
}
$GLOBALS['TYPO3_CONF_VARS']['FE']['addRootLineFields'].= ',tx_realurl_pathsegment';
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['realurl'] = array (
    '_DEFAULT' => array (
        'init' => array (
            'enableCHashCache' => '1',
            'appendMissingSlash' => 'ifNotFile',
            'enableUrlDecodeCache' => '1',
            'enableUrlEncodeCache' => '1'
        ),
        'redirects' => array (
        ),
        'preVars' => array (
            '0' => array (
                'GETvar' => 'no_cache',
                'valueMap' => array (
                    'nc' => '0'
                ),
                'noMatch' => 'bypass',
            ),
            '1' => array (
                'GETvar' => 'L',
                'valueMap' => array (
                    'de' => '0',
                    'en' => '1'
                ),
                'noMatch' => 'bypass'
            ),
            '2' => array (
                'GETvar' => 'cHash',
                'noMatch' => 'bypass',
            ),
        ),
        'pagePath' => array (
            'type' => 'user',
            'userFunc' => 'EXT:realurl/class.tx_realurl_advanced.php:&tx_realurl_advanced->main',
            'spaceCharacter' => '-',
            'languageGetVar' => 'L',
            'rootpage_id' => '1' // your root UID
        ),
        'fixedPostVars' => array(

        ),
        'postVarSets' => array(
            '_DEFAULT' => array(
                'controller' => array(
                    array(
                        'GETvar' => 'tx_news_pi1[action]',
                        'noMatch' => 'bypass'
                    ),
                    array(
                        'GETvar' => 'tx_news_pi1[controller]',
                        'noMatch' => 'bypass'
                    )
                ),
                'authentication' => array(
                        array(
                                'GETvar' => 'tx_eventmanagementtool_ext1[action]',
                        ),
                ),
                'dateFilter' => array(
                    array(
                        'GETvar' => 'tx_news_pi1[overwriteDemand][year]',
                    ),
                    array(
                        'GETvar' => 'tx_news_pi1[overwriteDemand][month]',
                    ),
                ),
                'page' => array(
                    array(
                        'GETvar' => 'tx_news_pi1[@widget_0][currentPage]',
                    ),
                ),

            ),
        ),
        'fileName' => array (
            //'defaultToHTMLsuffixOnPrev' => '.html',
            'acceptHTMLsuffix' => 1,
            'index' => array (
                'rss.xml' => array (
                    'keyValues' => array (
                        'type' => '100'
                    ),
                ),
                'rss091.xml' => array (
                    'keyValues' => array (
                        'type' => '101'
                    ),
                ),
                'rdf.xml' => array (
                    'keyValues' => array (
                        'type' => '102'
                    ),
                ),
                'atom.xml' => array (
                    'keyValues' => array (
                        'type' => '103'
                    ),
                ),
                'sitemap.xml' => array (
                    'keyValues' => array (
                        'type' => '776'
                    ),
                ),              
            ),
        ),
    )
);

Вы можете использовать метод обхода для удаления контроллера и действия из URL-адреса, например:

'controller' => array(
    array(
        'GETvar' => 'tx_news_pi1[action]',
        'noMatch' => 'bypass'
    ),
    array(
        'GETvar' => 'tx_news_pi1[controller]',
        'noMatch' => 'bypass'
    )
)
person Ghanshyam Gohel    schedule 16.12.2015

Перейдите в папку расширения.

В Configuration -> TypoScript -> setup.txt напишите следующий код:

plugin.tx_[your_extensionname].features.skipDefaultArguments = 1

Внимание: это работает, только если вы не используете switchableControllerActions в своей гибкой форме.

person vijay rami    schedule 19.12.2015