From c85c1813c3fa65f6c9e93ec74ea46b5e35ab9870 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ju=CC=88rg=20Messmer?= Date: Sun, 27 Nov 2022 06:44:14 -0600 Subject: [PATCH 1/2] decide in template the display of first image - do I want to show an image and for all or just the first most current entries? - code suggestions in example template --- .../journal/JournalFrontendModule.php | 5 ++-- .../journal_entry_teaser_example.tmpl | 24 +++++++++++++++++++ 2 files changed, 27 insertions(+), 2 deletions(-) create mode 100644 modules/frontend/journal/templates/journal_entry_teaser_example.tmpl diff --git a/modules/frontend/journal/JournalFrontendModule.php b/modules/frontend/journal/JournalFrontendModule.php index b641294..b0060e1 100644 --- a/modules/frontend/journal/JournalFrontendModule.php +++ b/modules/frontend/journal/JournalFrontendModule.php @@ -39,10 +39,11 @@ private function renderRecentJournalEntryTeasers($mJournalId, $iLimit) { } $oListTemplate = $this->constructTemplate('teaser_list'); $oTeaserTemplate = $this->constructTemplate('journal_entry_teaser'); - foreach($oJournalEntries as $i => $oJournalEntry) { + foreach($oJournalEntries as $iIndex => $oJournalEntry) { $oTemplate = clone $oTeaserTemplate; // show image of first journal entry teaser if a template identifier 'image_display_url' exists. - if($oTemplate->hasIdentifier('image_display_url') && $i === 0) { + if($oTemplate->hasIdentifier('image_display_url')) { + $oTemplate->replaceIdentifier('index', $iIndex); $oImage = $oJournalEntry->getImages(1)->getFirst(); if($oImage) { $oDocument = $oImage->getDocument(); diff --git a/modules/frontend/journal/templates/journal_entry_teaser_example.tmpl b/modules/frontend/journal/templates/journal_entry_teaser_example.tmpl new file mode 100644 index 0000000..72c5eb4 --- /dev/null +++ b/modules/frontend/journal/templates/journal_entry_teaser_example.tmpl @@ -0,0 +1,24 @@ + + +

{{title}}

+{{identifierContext=start;name=image_display_url}} +{{if=<;1=\{\{index\}\};2=2}} +

+ + {{image_description}} + + {{image_description}} +

+{{endIf}} +{{identifierContext=end;name=image_display_url}} +

+ {{writeParameterizedString=journal.publish_date;date=\{\{date_timestamp\}\}}}{{identifierContext=start;name=user_name}}, {{user_name}}{{identifierContext=end;name=user_name}} +

+{{text_short}} +{{writeString=wns.read_more}} From 9f70dcfab4ba7d2cdcfddaf64d486c6ac4521ad8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ju=CC=88rg=20Messmer?= Date: Fri, 2 Jun 2023 11:26:05 -0600 Subject: [PATCH 2/2] raise number of entries with photo, comments --- .../journal/templates/journal_entry_teaser_example.tmpl | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/modules/frontend/journal/templates/journal_entry_teaser_example.tmpl b/modules/frontend/journal/templates/journal_entry_teaser_example.tmpl index 72c5eb4..a6dbb80 100644 --- a/modules/frontend/journal/templates/journal_entry_teaser_example.tmpl +++ b/modules/frontend/journal/templates/journal_entry_teaser_example.tmpl @@ -2,13 +2,14 @@ Example of html for displaying first image of journal entry image gallery in teaser Change (or add) the template "journal_entry_teaser.tmpl" in site/modules/frontend/journal/templates/journal_entry_teaser.tmpl - use "IdentifierContext" for displaying image related content, if exists - - optionally use lessThan (if=<) condition within this context, to limit view of image for a specific number of entries (... 2=2) + - optionally use lessThan (if=<) condition within this context, to limit view of image to a specific number of entries (... 2=3) For further information check JournalFrontendModule.php and Template related classes -->

{{title}}

{{identifierContext=start;name=image_display_url}} -{{if=<;1=\{\{index\}\};2=2}} +// show the first image of journal gallery for first three entries, if they exist +{{if=<;1=\{\{index\}\};2=3}}

{{image_description}}