Search code examples
typoscripttypo3-7.6.xrealurltx-news

Realurl-Configuration for news-Extensi


I have an problem with the news-configuration for realurl.
TYPO3: 7.6.11
realurl: 2.1.4
news: 5.2.0

I created the following realurl_conf.php. (http://pastebin.com/GsYVaaDr):

<?php
// realurl naming precedence configuration
$TYPO3_CONF_VARS['FE']['addRootLineFields'] .= 'tx_realurl_pathsegment,alias,title';

$TYPO3_CONF_VARS['EXTCONF']['realurl']['p372493.mittwaldserver.info'] = array(
    'init' => array(
        'enableCHashCache' => true,
        'appendMissingSlash' => 'ifNotFile',
        'adminJumpToBackend' => true,
        'enableUrlDecodeCache' => true,
        'enableUrlEncodeCache' => true,
        'emptyUrlReturnValue' => '/',
        // Allow for proper SEO 404 handling
        'postVarSet_failureMode' => ''
    ),

    'redirects'  => array(),
    'preVars' => array(
        array(
            'GETvar' => 'no_cache',
            'valueMap' => array(
                'nc' => 1
            ),
            'noMatch' => 'bypass'
        ),
        array(
            'GETvar' => 'L',
            'valueMap' => array(
                // Sprachvariable Deutsch
                'de' => '0',
            ),
        'noMatch' => 'bypass',
        ),
    ),
    // PAGEPATH mit Standard-Realurl-Konfiguration
    'pagePath' => array(
        'type'   => 'user',
        'userFunc' => 'EXT:realurl/class.tx_realurl_advanced.php:&tx_realurl_advanced->main',
        'spaceCharacter' => '-',
        'languageGetVar' => 'L',
        'rootpage_id'  => 1,
        'expireDays' => 30,
        // Nimmt Sysordner aus der Rootline (aktuell auskommentiert!)
        'excludeDoktypes' => '254',
        'segTitleFieldList' => 'tx_realurl_pathsegment,alias,title'
    ),
    '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'
            ),

            'dateFilter' => array(
                array(
                    'GETvar' => 'tx_newss_pi1[year]',
                ),
                array(
                    'GETvar' => 'tx_newss_pi1[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',
                    ),
                ),
                array(
                    'GETvar' => 'tx_newss_pi1[day]',
                ),
            ),

            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,
                ),
            ),
        ), 
    ),
    'postVarSets' => array(
        '_DEFAULT' => array(

            // NEWS
           'newsCategoryConfiguration' => 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' => '-'
                        ),
                    ),
                ),
            ),
            'newsTagConfiguration' => 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' => '-'
                        ),
                    ),
                ),
            ),
            '28' => 'newsDetailConfiguration',
#           '701' => 'newsDetailConfiguration', // For additional detail pages, add their uid as well
#           '71' => 'newsTagConfiguration',
#           '72' => 'newsCategoryConfiguration',           

            'controller' => array(
                array(
                    'GETvar' => 'tx_news_pi1[action]',
                    'noMatch' => 'bypass'
                ),
                array(
                    'GETvar' => 'tx_news_pi1[controller]',
                    'noMatch' => 'bypass'
                ),
            ),

//          'archiv' => array(
//              'GETvar' => '',
//              noMatch => 'bypass'
//          ),
        // NEWS
        ),
    ),
    'fileName' => array (
        'defaultToHTMLsuffixOnPrev' => true,
        'index' => array(
            'sitemap.xml' => array(
                'keyValues' => array(
                    'type' => 841132,
                ),
            ),
            'feed.rss' => array(
                'keyValues' => array(
                    type => 9818,
                ),
            ),
            'calender.ical' => array (
                'keyValue' => array(
                    type => 9819,
                ),
            ),

            'robots.txt' => array(
                'keyValues' => array(
                    'type' => 841133
                ),
            ),

            'drucken.html' => array(
                'keyValues' => array(
                    'type' => '98',
                    'print' => '1'
                ),
            ),

            'index.html' => array(
                'keyValues' => array(
                    'type' => '0',
                ),
            ),
        ),
        'defaultToHTMLsuffixOnPrev' => true,
        'acceptHTMLsuffix' => true,
    ),

);
?>

I configured the News plugin as follows.

plugin.tx_news {
  settings {
    backPid = 25
    listPid = 25

    detail {
      showPrevNext = 1
      showSocialShareButtons = 0
    }

    list {
      media {
        image >
        image {
          maxWidth = 75
          maxHeight = 75
        }
      }
    }

    link {
      skipControllerAndAction = 1
      hrDate = 1
      hrDate {
        day = d
        month = m
        year = Y
      }
    }    

    paginate {
      itemsPerPage = 10
      insertAbove = 1
      insertBelow = 1
      templatePath =
      prevNextHeaderTags = 1
      maximumNumberOfLinks = 3
    }

    analytics.social {
      facebookLike = 0
      facebookShare = 0
      twitter = 0
    }
  }
  predefine.archive = +1 Month
}

This configuration issues addresses in the following form:

/nachricht/detail/News/news-title/archiv/2016/september.html?tx_news_pi1%5Bday%5D=2&cHash=bc08b3c694b77edd4d3de72396906807

but I need address output like this form:

/nachricht/detail/News/2016/09/02/news-title.html

nachricht is the title of the page. The basic configuration of realurl running fine.

Someone has an idea or can tell me, how to update my news part of the configuration?


Solution

  • First, change the 'enableCHashCache' => true to 'enableCHashCache' => FALSE in your realurl_conf.php for remove cHash=.... from your url. and change below code in postVatSets array for realurl. Try this solution and let me know your feedback. This code works for me.

    'postVarSets' => array(
            '_DEFAULT' => array(
                //archive
                'period' => array (
                    array (
                        'condPrevValue' => -1,
                        'GETvar' => 'tx_ttnews[pS]',
                        //'valueMap => array()
                        ),
                    array (
                        'GETvar' => 'tx_ttnews[pL]',
                        //'valueMap => array()
                        ),
    
                    array (
                        'GETvar' => 'tx_ttnews[arc]',
                        'valueMap' => array(
                            'non-archived' => -1,
                            ),
                        ),
                    ),
                'archive' => array(
                        array(
                            'GETvar' => 'tx_ttnews[year]' ,
                            ),
                        array(
                            'GETvar' => 'tx_ttnews[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',
                                )
                            ),
                        ),
    
                'browse' => array (
                    array (
                        'GETvar' => 'tx_ttnews[pointer]',
                        ),
                    ),
                'select' => array (
                    array (
                        'GETvar' => 'tx_ttnews[cat]',
                        'lookUpTable' => array (
                            'table'     =>  'tt_news_cat',
                            'id_field'  =>  'uid',
                            'alias_field'   =>  'title',
                            'addWhereClause'=>  'AND NOT deleted',
                            'useUniqueCache'=>  1,
                            'useUniqueCache_conf'   =>  array (
                                'strtolower'        =>  1,
                                'spaceCharacter'    =>  '-',
                                ),
                            ),
                        ),
                    ),
                'article' => array( 
    
                    array (
                        'GETvar' => 'tx_ttnews[tt_news]',
                        'lookUpTable' => array (
                            'table'     =>  'tt_news',
                            'id_field'  =>  'uid',
                            'alias_field'   =>  'title',
                            'addWhereClause'=>  'AND NOT deleted',
                            'useUniqueCache'=>  1,
                            'useUniqueCache_conf'   =>  array (
                                'strtolower'        =>  1,
                                'spaceCharacter'    =>  '-',
                                ),
                            ),
                        ),
                    ),
                ),
            ),