diff --git a/Classes/Controller/LatestController.php b/Classes/Controller/LatestController.php index 57860f85328f9e0b8f294389c009c2dacaa8a7fc..1cd7fda2fd1e5946649e5326f8ffadc420632bc1 100644 --- a/Classes/Controller/LatestController.php +++ b/Classes/Controller/LatestController.php @@ -55,17 +55,13 @@ class LatestController extends AbstractController { $limit = ((int) $this->settings['limit']); $limit = ($limit < 1 ? 1 : $limit); - $filterByCategories = FALSE; - $categoryUids = GeneralUtility::intExplode(',', $this->settings['categories']); - foreach ($categoryUids as $categoryUid) { - if ($categoryUid > 0) { - $filterByCategories = TRUE; - break; - } + $categoryUids = GeneralUtility::intExplode(',', $this->settings['categories'], TRUE); + if (!count($categoryUids) && (int) $GLOBALS['TSFE']->page['doktype'] === 117) { + $categoryUids = [$GLOBALS['TSFE']->id]; } $latestNewsEntries = $this->newsRepository->findLastUpdatedOrHighlightedNewsByCategories( - $limit, FALSE, ($filterByCategories ? $categoryUids : NULL), 0, TRUE + $limit, FALSE, $categoryUids, 0, TRUE ); $newsMetaData = []; @@ -73,7 +69,6 @@ class LatestController extends AbstractController { foreach ($latestNewsEntries as $latestNewsEntry) { /** @var News $latestNewsEntry */ /** @var Category $category */ - $categoryUid = $latestNewsEntry->getPid(); $category = $categories[$categoryUid]; if (!$category) { @@ -90,5 +85,3 @@ class LatestController extends AbstractController { $this->view->assign('newsMetaData', $newsMetaData); } } - -?> diff --git a/Classes/Domain/Repository/NewsRepository.php b/Classes/Domain/Repository/NewsRepository.php index 867e94c0baad9f91e3f5e21a5acccde5b8bd6e0a..0bd357817f269df33b252d82f7eb38f582c4f874 100644 --- a/Classes/Domain/Repository/NewsRepository.php +++ b/Classes/Domain/Repository/NewsRepository.php @@ -99,7 +99,7 @@ class NewsRepository extends AbstractRepository { ) { $query = $this->createQuery(); $constraints = NULL; - if ($categoryIds !== NULL && is_array($categoryIds)) { + if ($categoryIds !== NULL && count($categoryIds)) { $constraints[] = $query->in('pid', $categoryIds); } diff --git a/README.md b/README.md index 46c32ff5eedb2cd85c426995c5f154bf19a027f6..01608cecdafcf859283c7ac054c2b41fc24c8bbc 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,7 @@ extension itself provides two new doktypes, we can simply add a switch case to o to provide different rendering paths. Please look at the example below: ``` +lib.pageTemplate.default > lib.pageTemplate.default = FLUIDTEMPLATE lib.pageTemplate.default { file = EXT:project_theme/Resources/Private/Templates/Default.html @@ -19,6 +20,12 @@ lib.pageTemplate.default { 116 = TEXT 116.value = + 117 = COA + 117 { + 10 < tt_content.list.20.sgnews_latest + 20 < styles.content.col0 + } + # just show the content default < styles.content.col0 } @@ -31,7 +38,11 @@ lib.pageTemplate.default { 116 < tt_content.list.20.sgnews_singleview # show the category view of the news if the page type matches - 117 < tt_content.list.20.sgnews_listbycategory + 117 = COA + 117 { + 10 < tt_content.list.20.sgnews_listbycategory + 20 < styles.content.col1 + } # just show the content default < styles.content.col1 diff --git a/Resources/Private/Templates/ListByCategory/Index.html b/Resources/Private/Templates/ListByCategory/Index.html index 172ef2adab597699d93a0e5b1e284140dc9bd917..35795fd47bed58aceb061e5afe021603118c8655 100644 --- a/Resources/Private/Templates/ListByCategory/Index.html +++ b/Resources/Private/Templates/ListByCategory/Index.html @@ -3,7 +3,15 @@ {namespace sg=SGalinski\SgNews\ViewHelpers} <f:section name="main"> - <section class="content light-bg "> + <section class="content light-bg"> + <div class="container"> + <f:for each="{categories}" as="category"> + <h2 class="tx-sgnews-category-title">{category.subtitleWithFallbackToTitle}</h2> + </f:for> + </div> + </section> + + <section class="content light-bg"> <div class="container tx-sgnews-categories"> <ul class="tx-sgnews-list row"> <f:for each="{newsMetaData}" as="newsMetaDataEntry">