<tpl:AttachmentIf>

Different tests on attachments characteristics. We can test if the attached file has the characteristic (value "1") or not (value "0"). To apply a model to other files, invert the last positive test (i.e. if we tested the case where is_flv="1" at the end, we have to test the case where is_flv="0" for other files scheme).

Attributes

is_image

Tests if the attached file is an image (png, jpg, gif…)

has_thumb

Tests if the attached file has a square shaped thumbnail.

is_mp3

Tests if the attached file is an mp3 sound file.

is_flv

Tests if the attached fils is a flv video.

Example

        <tpl:AttachmentIf is_mp3="1">
          {{tpl:include src="_mp3_player.html"/}} - 
        </tpl:AttachmentIf>

will display the Flash reader if the attached file is an mp3 sound.

        <tpl:AttachmentIf is_flv="1">
	     {{tpl:include src="_flv_player.html"/}}
	   </tpl:AttachmentIf>

will display the Flash video player if the attached file is a flv video.

	   <tpl:AttachmentIf has_thumb="1">
	   	<a href="{{tpl:AttachmentURL}}"
		title="{{tpl:AttachmentFileName}} ({{tpl:AttachmentSize}})"><img src="{{tpl:AttachmentThumbnailURL}}" alt="{{tpl:AttachmentTitle}}" /></a>
        </tpl:AttachmentIf>

displays the image thumbnail with a link on it.

	   <tpl:AttachmentIf has_thumb="0">
	   	<a href="{{tpl:AttachmentURL}}"
		title="{{tpl:AttachmentFileName}} ({{tpl:AttachmentSize}})">{{tpl:AttachmentTitle}}</a>
        </tpl:AttachmentIf>

displays the title and a link to the attached files that were not caught by the previous tests.

Wiki powered by Dokuwiki.