- Posts: 28
COMMUNITY FORUM
echo video id
- neppers
-
Topic Author
- Offline
- Junior Member
Less
More
6 years 6 months ago #169446
by neppers
echo video id was created by neppers
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.
- JoomlaWorks
-
- Offline
- Admin
Less
More
- Posts: 6227
6 years 6 months ago #169465
by JoomlaWorks
Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by JoomlaWorks on 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.
Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- neppers
-
Topic Author
- Offline
- Junior Member
Less
More
- Posts: 28
6 years 6 months ago - 6 years 6 months ago #169477
by neppers
Replied by neppers on 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&fs=1&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: 6 years 6 months ago by neppers. Reason: Translated
Please Log in or Create an account to join the conversation.
- JoomlaWorks
-
- Offline
- Admin
Less
More
- Posts: 6227
6 years 6 months ago #169482
by JoomlaWorks
Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by JoomlaWorks on topic echo video id
Much better approach :) Kudos!
Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.