[OJS 3.1.2-4] Display/filter according to genre on article_details

Dear all
I’ve got some video abstracts as supplementary files (and an according genre: “videoabstract”). On the article_details.tpl I would like to show the video.

But first I would just like to know how I could do something like
{if $supplementaryGenre = "videoabstract"}
<video>
<source type="video/mp4" src="{foreach from=$supplementaryGalleys item=galley}
{include file="frontend/objects/galley_link.tpl" parent=$article publication=$publication galley=$galley isSupplementary="1"}
{/foreach}" />
</video>
{/if}

Thanks a lot
Klaus

Essentially, what I would need is a variable and some piece of code to display a <div> ... </div> depending on the name or presence of the (supplementary)genre, ideally including the full path to the file ending *.mp4 or *.webm.
Is it correct that even supplementary content BUT which has a remote-URL will be displayed as primary content ($primaryGalleys) on the website?
Could some of you please have a look at this? Maybe @NateWr or @Vitaliy or @bozana

Thank you so much and all the best
Klaus

Hi @klausru,

If you’re working with a single installation and the id of the file genre will not change, you can use that in your code similar to this:

{foreach from=$supplementaryGalleys item="galley"}
  {assign var="file" value=$galley->getFile()}
  {if {$file->getGenreId() == /* the correct genre id */}
    <video>
      ...
    </video>
  {/if}
{/foreach}
1 Like

Hi @NateWr
thanks so much. It works!
Here’s what I’ve done:

{foreach from=$supplementaryGalleys item="galley"}
  {assign var="file" value=$galley->getFile()}
  {if $file->getGenreId() == 13}
      <video class="afterglow" id="myvideo" width="350" height="197">
           <source type="video/mp4" src="{include file="frontend/objects/videoabstract_link.tpl" parent=$article galley=$galley isSupplementary="1"}" />
       </video>
  {/if}
{/foreach}

Moreover, I can now switch off the supplementary galley download link in case it is a videoabstract:

	{if $file->getGenreId() !== 13}
		{if $supplementaryGalleys}
			<div class="item galleys">
					...
			</div>
		{/if}
        {/if}
1 Like

This could be useful for https://seminar.net , too @Eirik_Hanssen

Regards,
Klaus

That’s great! Thanks for sharing your code.