2016-05-13 52 views
0

帶有tx_news的realurl配置適合我,但我遇到了一個問題。我不需要地址中的詳細名稱。TYPO3 7.6 - tx_news 4.2.1 - realurl中沒有詳細名稱?

www.domain.org/news-list/ 新聞細節 /測試新聞名稱這裏/

,現在我不需要了「新聞細節」。

這裏的PHP代碼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, 
), 
); 

?> 

我需要的Typo腳本?

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

在詳細頁我檢查realurl:

tx_realurl_exclude = 1 
+1

你確定你的問題與realUrl有關嗎?新聞詳情頁面的網址是什麼? – sven

+0

我不知道這是否是由於擴張消息。它也可能是RealUrl的一個問題。 我已經在deatil站點上查看了「不要在realurl中顯示」一點。 :( –

+0

如需進一步的幫助,瞭解新聞詳細信息頁面的URL是很重要的。如果您瀏覽到/ news-list/news-detail,會發生什麼情況? – sven

回答

2

您可以在同一頁面上使用詳細的&列表插件。檢查這個網址: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] 
+0

好的,謝謝,它可以在配置:列表和詳細信息在同一頁面上正常工作! –

2

答:這是不可能的,從講URL排除目前的(=上)頁面。

如果您對技術細節感興趣,您可以在RealURL的notes for integrators中閱讀更多信息。

1

只是一個額外的隨訪與另一種解決方案:

使用的TypoScript條件動態地呈現在列表頁的詳細插件。

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

當然,如果你需要渲染例如圖像,你可以做更多的花哨的東西。其他內容元素也是如此!

[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] 

這會呈現列表頁面上詳細頁面的所有內容元素。