RenderMediaViewHelper
ViewHelper to render media from any content
Type: Basic
General properties
Name: |
Type: |
Description: |
Default value: |
---|---|---|---|
news (required) |
Tx_News_Domain_Model_News |
The news post | |
imgClass |
string |
Add css class to images. | |
videoClass |
string |
Wrap videos in a div with this css class. | |
audioClass |
string |
Wrap audio files in a div with this css class | |
fileIndex |
integer |
index of image to start with | |
cropVariant |
string |
Select a cropping variant, in case multiple croppings have been specified or stored in FileReference |
default |
Examples
Basic usage
Use [media]
in the RTE fields of a news. In Fluid tempate wrap rendering of text fields with the VieHelper.
Backend:
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy
eirmod tempor invidunt ut labore et dolore magna aliquyam erat,
sed diam voluptua.
[media]
At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd
gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
[media]
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy
eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam
voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita
kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
Code:
<n:renderMedia news="{newsItem}" imgClass="img-responsive" videoClass="video-wrapper" audioClass="audio-wrapper">
<div class="news-text-wrap" itemprop="articleBody">
<f:format.html>{newsItem.bodytext}</f:format.html>
</div>
</n:renderMedia>
Output:
Media tags in RTE of the text are replaced with images.
Tip
Move news detail template to your site-package and remove default rendering of images to avoid duplicates.
Tip
Use file
attribute to not start with the first image.
Tip
Use "Show in views" setting for the images to control visibility in detail view.
Tip
Change sorting of images in backend to change the order of images in frontend.