Skip to content

Commit c85c181

Browse files
committed
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
1 parent 542ccc7 commit c85c181

File tree

2 files changed

+27
-2
lines changed

2 files changed

+27
-2
lines changed

modules/frontend/journal/JournalFrontendModule.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,11 @@ private function renderRecentJournalEntryTeasers($mJournalId, $iLimit) {
3939
}
4040
$oListTemplate = $this->constructTemplate('teaser_list');
4141
$oTeaserTemplate = $this->constructTemplate('journal_entry_teaser');
42-
foreach($oJournalEntries as $i => $oJournalEntry) {
42+
foreach($oJournalEntries as $iIndex => $oJournalEntry) {
4343
$oTemplate = clone $oTeaserTemplate;
4444
// show image of first journal entry teaser if a template identifier 'image_display_url' exists.
45-
if($oTemplate->hasIdentifier('image_display_url') && $i === 0) {
45+
if($oTemplate->hasIdentifier('image_display_url')) {
46+
$oTemplate->replaceIdentifier('index', $iIndex);
4647
$oImage = $oJournalEntry->getImages(1)->getFirst();
4748
if($oImage) {
4849
$oDocument = $oImage->getDocument();
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<!--
2+
Example of html for displaying first image of journal entry image gallery in teaser
3+
Change (or add) the template "journal_entry_teaser.tmpl" in site/modules/frontend/journal/templates/journal_entry_teaser.tmpl
4+
- use "IdentifierContext" for displaying image related content, if exists
5+
- optionally use lessThan (if=<) condition within this context, to limit view of image for a specific number of entries (... 2=2)
6+
For further information check JournalFrontendModule.php and Template related classes
7+
-->
8+
9+
<h2><a href="{{link_to_detail}}" class="read_more" title="{{writeString=wns.read_more}}: „{{title}}“">{{title}}</a></h2>
10+
{{identifierContext=start;name=image_display_url}}
11+
{{if=<;1=\{\{index\}\};2=2}}
12+
<p class="images">
13+
<a href="{{link_to_detail}}" class="read_more" title="{{writeString=wns.read_more}}: {{title}}">
14+
<img src="{{image_display_url}}" alt="{{image_description}}" width="{{image_width}}" height="{{image_height}}" />
15+
</a>
16+
<span class="legend">{{image_description}}</span>
17+
</p>
18+
{{endIf}}
19+
{{identifierContext=end;name=image_display_url}}
20+
<p class="journal_sub">
21+
{{writeParameterizedString=journal.publish_date;date=\{\{date_timestamp\}\}}}{{identifierContext=start;name=user_name}}, {{user_name}}{{identifierContext=end;name=user_name}}
22+
</p>
23+
{{text_short}}
24+
<a href="{{link_to_detail}}" class="read_more">{{writeString=wns.read_more}}</a>

0 commit comments

Comments
 (0)