Skip to content

Commit

Permalink
[FEATURE] Ical detail view
Browse files Browse the repository at this point in the history
  • Loading branch information
georgringer committed Aug 2, 2023
1 parent 0a16288 commit 5eba25f
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 5 deletions.
18 changes: 13 additions & 5 deletions Documentation/Tutorials/BestPractice/ICalendar/Index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,14 @@ To be able to render a link in the header section of the normal page which point
<link rel="alternate" type="text/calendar" title="iCalendar 2.0" href="{f:uri.page(additionalParams:{type:9819})}" />
</n:headerData>

Add a link in fluid
"""""""""""""""""""

Use the following snippet to create a link to the detail view

.. code-block:: html

<n:link newsItem="{newsItem}" configuration="{additionalParams:'&type=9819'}">ical</n:link>

Change the iCalendar feed link with routing
"""""""""""""""""""""""""""""""""""""""""""
Expand All @@ -192,10 +200,10 @@ about :ref:`rewriting URLs for news <routing>`.
routeEnhancers:
News:
PageTypeSuffix:
type: PageType
map:
'feed.xml': 9818
'calendar.ical': 9819
PageTypeSuffix:
type: PageType
map:
'feed.xml': 9818
'calendar.ical': 9819
This will change the URL to :code:`/calendar.ical`.
11 changes: 11 additions & 0 deletions Resources/Private/Templates/News/Detail.ical
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{namespace n=GeorgRinger\News\ViewHelpers}BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//TYPO3/NONSGML News system (news)//EN
<f:if condition="{newsItem}">BEGIN:VEVENT
UID:news-{newsItem.uid}@{settings.domain}
DTSTAMP:<f:format.date format="%Y%m%dT%H%M%SZ"><f:variable name="tzoffset">{f:format.date(date: newsItem.tstamp, format: 'Z')}</f:variable>{newsItem.tstamp.timestamp - tzoffset}</f:format.date>
DTSTART:<f:format.date format="%Y%m%dT%H%M%S%z">{newsItem.datetime}</f:format.date>
DTEND:<f:format.date format="%Y%m%dT%H%M%S%z"><f:if condition="{newsItem.archive}"><f:then>{newsItem.archive}</f:then><f:else>{newsItem.datetime}</f:else></f:if></f:format.date>
SUMMARY:{newsItem.title -> f:format.htmlspecialchars()}
END:VEVENT
</f:if>END:VCALENDAR

0 comments on commit 5eba25f

Please sign in to comment.