Keyword

echo video id

  • neppers
  • neppers's Avatar Topic Author
  • Offline
  • Junior Member
More
1 month 2 weeks ago #169446 by neppers
neppers created the topic: echo video id
Is it possible to echo the video id with php inside a k2-template?

Please Log in or Create an account to join the conversation.

  • Fotis
  • Fotis's Avatar
  • Offline
  • Administrator
  • JoomlaWorks Support Team
More
1 month 2 weeks ago #169465 by Fotis
Fotis replied the topic: echo video id
I can't see an easy way really because $this->item->video will always print the rendered output, as it is processed from AllVideos.


If you use & love K2, please take a moment to add your review and rate it
at the Joomla Extensions Directory: extensions.joomla.org/extension/k2/


IMPORTANT: Please search the forum before posting a question!

JoomlaWorks Support Team Member

Please Log in or Create an account to join the conversation.

  • neppers
  • neppers's Avatar Topic Author
  • Offline
  • Junior Member
More
1 month 2 weeks ago - 1 month 2 weeks ago #169477 by neppers
neppers replied the topic: echo video id
This did it for me. Rather than trying to echo the ID in the k2 template, I cleaned the output and made a template-override for the allvideos plugin:
<?php 
$string = $output->player ;
$search = '<iframe src="https://www.youtube.com/embed/' ;
$trimmed = str_replace($search, '', $string) ;

$string = $trimmed ;
$search = '?rel=0&amp;fs=1&amp;wmode=transparent" width="400" height="300" allowfullscreen="true" frameborder="0" scrolling="no" title="JoomlaWorks AllVideos Player"></iframe>' ;
$trimmed = str_replace($search, '', $string) ;


 ?>

<div class="embed-responsive embed-responsive-16by9 mb-2">
<iframe title="Watch video" class="embed-responsive-item" src="https://www.youtube.com/embed/<?php echo $trimmed; ?>?rel=0&modestbranding=1" allowfullscreen></iframe>
</div>
Last Edit: 1 month 2 weeks ago by neppers. Reason: Translated

Please Log in or Create an account to join the conversation.

  • Fotis
  • Fotis's Avatar
  • Offline
  • Administrator
  • JoomlaWorks Support Team
More
1 month 2 weeks ago #169482 by Fotis
Fotis replied the topic: echo video id
Much better approach :) Kudos!


If you use & love K2, please take a moment to add your review and rate it
at the Joomla Extensions Directory: extensions.joomla.org/extension/k2/


IMPORTANT: Please search the forum before posting a question!

JoomlaWorks Support Team Member

Please Log in or Create an account to join the conversation.