Sebastian
Sebastian

Reputation: 929

TYPO3 7.6 - tx_news 4.2.1 - no detail name in realurl?

The realurl config with tx_news works fine for me, but I have one problem. I dont need the detail-name in the address.

www.domain.org/news-list/news-detail/test-news-name-here/

and now i dont need the "news-detail".

Here the PHP code realurl.php

<?php


$TYPO3_CONF_VARS['FE']['addRootLineFields'].= ',tx_realurl_pathsegment';
$TYPO3_CONF_VARS['EXTCONF']['realurl']['_DEFAULT'] = array( 
'pagePath' => array(
    'type' => 'user',
    'userFunc' => 'EXT:realurl/class.tx_realurl_advanced.php:&tx_realurl_advanced->main',
    'spaceCharacter' => '-',
    'languageGetVar' => 'L',
    'expireDays' => '3',
    'rootpage_id' => 1,
    'firstHitPathCache'=>1
),
'init' => array(
    'enableCHashCache' => TRUE,
    'enableCHashCache' => 1,
    'respectSimulateStaticURLs' => 0,
    'enableUrlDecodeCache' => 1,
    'enableUrlEncodeCache' => 1
),
'preVars' => array(
    array(
        'GETvar' => 'L',
        'valueMap' => array(
            //'de' => '0',
            //'en' => '1',
        ),
        'noMatch' => 'bypass',
    ),
    array(
        'GETvar' => 'no_cache',
        'valueMap' => array(
            'nc' => 1,
        ),
        'noMatch' => 'bypass',
    ),
),

'fileName' => array(
  'index' => array(
    'sitemap.xml' => array(
      'keyValues' => array(
        'type' => 1234,
      ),
    ),
  ),
),

'fixedPostVars' => array(
    'newsDetailConfiguration' => array(
        array(
            'GETvar' => 'tx_news_pi1[action]',
            'valueMap' => array(
                'detail' => '',
            ),
            'noMatch' => 'bypass',
        ),
        array(
            'GETvar' => 'tx_news_pi1[controller]',
            'valueMap' => array(
                'News' => '',
            ),
            'noMatch' => 'bypass',
        ),

        array(
            'GETvar' => 'tx_news_pi1[news]',
            'lookUpTable' => array(
                'table' => 'tx_news_domain_model_news',
                'id_field' => 'uid',
                'alias_field' => 'title',
                'addWhereClause' => ' AND NOT deleted',
                'useUniqueCache' => 1,
                'useUniqueCache_conf' => array(
                    'strtolower' => 1,
                    'spaceCharacter' => '-',
                ),
                'languageGetVar' => 'L',
                'languageExceptionUids' => '',
                'languageField' => 'sys_language_uid',
                'transOrigPointerField' => 'l10n_parent',
                'autoUpdate' => 1,
                'expireDays' => 180,
            ),
        ),
    ),

    '6' => 'newsDetailConfiguration',
    // For additional detail pages, add their uid as well
    //'13' => 'newsDetailConfiguration',
    //'22' => 'newsDetailConfiguration',
    //'4' => 'newsTagConfiguration',
    //'4' => 'newsCategoryConfiguration',

),
'postVarSets' => array(
    '_DEFAULT' => array(
        'controller' => array(
            array(
                'GETvar' => 'tx_news_pi1[action]',
                'noMatch' => 'bypass',
            ),
            array(
                'GETvar' => 'tx_news_pi1[controller]',
                'noMatch' => 'bypass',
            ),
        ),
        'stadt' => array(
            array(
                'GETvar' => 'tx_news_pi1[overwriteDemand][categories]',
                'lookUpTable' => array(
                    'table' => 'sys_category',
                    'id_field' => 'uid',
                    'alias_field' => 'title',
                    'addWhereClause' => ' AND NOT deleted',
                    'useUniqueCache' => 1,
                    'useUniqueCache_conf' => array(
                        'strtolower' => 1,
                        'spaceCharacter' => '-',
                    ),
                ),
            ),
        ),

        'tags' => array(
            array(
                'GETvar' => 'tx_news_pi1[overwriteDemand][tags]',
                'lookUpTable' => array (
                  'table' => 'tx_news_domain_model_tag',
                  'id_field' => 'uid',
                  'alias_field' => 'title',
                  'addWhereClause' => 'AND NOT deleted',
                  'useUniqueCache' => 1,
                  'useUniqueCache_conf' => array (
                    'strtolower' => 1,
                    'spaceCharacter' => '-',
                    ),
                ),
            ),
        ),

        'seite' => array(
            array(
                'GETvar' => 'tx_news_pi1[@widget_0][currentPage]',
            ),
        ),

        // news archive parameters
        'archiv' => array(
            array(
                'GETvar' => 'tx_news_pi1[overwriteDemand][year]',
            ),
            array(
                'GETvar' => 'tx_news_pi1[overwriteDemand][month]',
                'valueMap' => array(
                    'january' => '01',
                    'february' => '02',
                    'march' => '03',
                    'april' => '04',
                    'may' => '05',
                    'june' => '06',
                    'july' => '07',
                    'august' => '08',
                    'september' => '09',
                    'october' => '10',
                    'november' => '11',
                    'december' => '12',
                ),
            ),
        ),

    ),
),
// configure filenames for different pagetypes
'fileName' => array(
    'defaultToHTMLsuffixOnPrev' => 0,
),
);

?>

I need that typoscript?

plugin.tx_news {
    settings {
            link {
                    skipControllerAndAction = 1
            }
    }
}

In the Detail-Page I check the realurl:

tx_realurl_exclude = 1

Upvotes: 0

Views: 1239

Answers (4)

Krystian Szymukowicz
Krystian Szymukowicz

Reputation: 1488

If you want to have list and single view on separate pages then extension singleview at https://github.com/sourcebroker/singleview does exactly what you want.

This extension uses TYPO3 build in feature "Show content from pid" which you can find in page properties. In this extension value for "Show content from pid" field is set dynamically based on $_GET parameter. When TYPO3 renders page with list view then ext:singleview checks if $_GET parameter has single view request. If this is true then it sets "content_from_pid" field with value of single view page uid. This way single view page with its content and layout is shown on list view page.

For TYPO3 7.6 use ext:singlenews version 1.3.

Upvotes: 0

Andrei Todorut
Andrei Todorut

Reputation: 4526

You can use detail & list plugin on the same page. Check this url: https://forge.typo3.org/issues/50489

lib.news = USER
lib.news {
  userFunc = tx_extbase_core_bootstrap->run
  pluginName = Pi1
  extensionName = News
  controller = News
  settings =< plugin.tx_news.settings
  persistence =< plugin.tx_news.persistence
  view =< plugin.tx_news.view
}

lib.news_list< lib.news
lib.news_list {
  action = list
  switchableControllerActions.News.1 = list
}

lib.news_detail < lib.news
lib.news_detail {
  action = detail
  switchableControllerActions.News.1 = detail
}

[globalVar = GP:tx_news_pi1|news > 0]
  lib.field_news_single < lib.news_detail
[else]
  lib.field_news_list < lib.news_list
[end]

Upvotes: 2

Georg Ringer
Georg Ringer

Reputation: 7939

Just an additional followup with another solution:

Use a TypoScript condition to render dynamically the detail plugin at the list page.

[globalVar = GP:tx_news_pi1|news > 0]
  page.10 >
  page.10 < lib.news
[global]

Of course you can do a lot more fancy stuff if you need to render e.g. other content elements as well!

[globalVar = GP:tx_news_pi1|news > 0]
  page.10 >
  page.10 = CONTENT
  page.10 {
    table = tt_content
    pidInList = <page ID of your detail page>
    orderBy = sorting
  }
[global]   

This will render you all content elements of the detail page on the list page.

Upvotes: 1

User366
User366

Reputation: 796

Answer: it is not possible to exclude the current (=last) page from speaking URL.

If you are interested in technical details, you can read more in the RealURL's notes for integrators.

Upvotes: 2

Related Questions