Search code examples
typo3tx-news

TYPO3 extbase news ajax pagebrowser


TYPO3 6.1

I have applied the ajax for news pagebrowser. To do that I have added below code in setup

news_ajax_list = PAGE
news_ajax_list {
typeNum = 1122
config {
disableAllHeaderCode = 1
xhtml_cleaning = 0
admPanel = 0
debug = 0
no_cache = 1
}
10 = USER
10 {
userFunc = tx_extbase_core_bootstrap->run
extensionName = News
pluginName = Pi1
switchableControllerActions.News.1 = list
}
}

and my ajax jquery code looks like this.

$changeduri = $('.page-navigation .f3-widget-paginator li.next').find('a').prop('href')+'&type=1122';
var uri = $changeduri;
$.ajax({
url: uri,
type :'GET',
success: function(data) {
$('.news .news-list-view .page-navigation').before($(data).find('.news-list-view .ajaxcnt').html());
$('.news .news-list-view .page-navigation').html($(data).find('.news-list-view .page-navigation').html());
$('.news .news-list-view .page-navigation').after("<script type='text/javascript'>$('.f3-widget-paginator .next').click(function(e) { e.preventDefault();renderUrl();});</script>");
}
});

The Ajax pagebrowser works very well. But my problem is the url to detail page is not linking to detail page, instead its linking to current page (list page) itself. I have printed {settings.detailPid} in Partials/List/List.html and that was empty for ajax loaded news list items. And it was correct for initial loaded news list items

What was the problem here? Any help?


Solution

  • As you found out yourself, your settings are empty. You should add the settings for news to your TypoScript:

    news_ajax_list = PAGE
    news_ajax_list {
      [...]
      10 = USER
      10 {
        [...]
        settings < plugin.tx_news.settings
        # (over)write detailPid if it is not set/set differently in your news configuration
        settings.detailPid = 31
      }
    }