COMMUNITY FORUM
How to get Youtube video url
- Gianluca Pantaleo
-
Topic Author
- Offline
- New Member
Less
More
10 years 4 months ago #134628
by Gianluca Pantaleo
How to get Youtube video url was created by Gianluca Pantaleo
Hello guys,
I would like to add the og:video meta into K2 item.php file. So I tried to add this code:butreturn something likeand than joomla convert it in a more complex html output. Is it any way to get only the url to have this output:
Thanks a lot.
I would like to add the og:video meta into K2 item.php file. So I tried to add this code:
<?php
$doc =& JFactory::getDocument();
$doc->addCustomTag('
<meta property="og:video" content="'.$this->item->video.'"/>
');
?>
'.$this->item->video.'
{youtube}https://www.youtube.com/watch?v=55CD_6dySek{/youtube}
<meta property="og:video" content="https://www.youtube.com/watch?v=55CD_6dySek"/>
Thanks a lot.
Please Log in or Create an account to join the conversation.
- Lefteris
-
- Offline
- Moderator
Less
More
- Posts: 8743
10 years 4 months ago - 10 years 4 months ago #134629
by Lefteris
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by Lefteris on topic How to get Youtube video url
Hi. If ti will always be a Youtube video you can try this:
<?php
$video = preg_replace('%\{[a-z0-9-_]*\}(.*)\{/[a-z0-9-_]*\}%i', '\1', $this->item->video);
$doc = JFactory::getDocument();
$doc->addCustomTag('<meta property="og:video" content="'.$video.'"/>');
?>
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Last edit: 10 years 4 months ago by Lefteris.
Please Log in or Create an account to join the conversation.
- Gianluca Pantaleo
-
Topic Author
- Offline
- New Member
10 years 4 months ago #134636
by Gianluca Pantaleo
Replied by Gianluca Pantaleo on topic How to get Youtube video url
I tried with your code but still returns the full html output:
<meta property="og:video" content="
<!-- JoomlaWorks "AllVideos" Plugin (v4.4) starts here -->
<div class="avPlayerWrapper avVideo">
<div style="width:100%px;" class="avPlayerContainer">
<div id="AVPlayerID_d3de9e25_1327127577" class="avPlayerBlock">
<iframe src="https://www.youtube.com/embed/55CD_6dySek?rel=0&fs=1&wmode=transparent" width="100%" height="300" frameborder="0" allowfullscreen title="JoomlaWorks AllVideos Player"></iframe>
</div>
</div>
</div>
<!-- JoomlaWorks "AllVideos" Plugin (v4.4) ends here -->
"/>
Please Log in or Create an account to join the conversation.
- Lefteris
-
- Offline
- Moderator
Less
More
- Posts: 8743
10 years 4 months ago #134695
by Lefteris
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by Lefteris on topic How to get Youtube video url
Yes, this is normal, since the code in the template file is executed after the plugin code. You cannot do this with code in the template. You need to create a plugin and place the code there.
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- Gianluca Pantaleo
-
Topic Author
- Offline
- New Member
10 years 4 months ago #134697
by Gianluca Pantaleo
Replied by Gianluca Pantaleo on topic How to get Youtube video url
Can I disable or comment the code where "All Videos" plugin take {youtube} and converti it, please? Thanks
Please Log in or Create an account to join the conversation.
- Lefteris
-
- Offline
- Moderator
Less
More
- Posts: 8743
10 years 4 months ago #134699
by Lefteris
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by Lefteris on topic How to get Youtube video url
If you disable the code that is doing this the video will not play in your page. It is not recommended to modify the plugin since you will loose your changes in future updates.
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- Gianluca Pantaleo
-
Topic Author
- Offline
- New Member
10 years 4 months ago #134705
by Gianluca Pantaleo
Replied by Gianluca Pantaleo on topic How to get Youtube video url
Ok I understand. However, I am not a developer and I have to find another solution
Please Log in or Create an account to join the conversation.
- Wymian
-
- Offline
- New Member
Less
More
- Posts: 1
10 years 4 months ago #134861
by Wymian
Replied by Wymian on topic How to get Youtube video url
thx, i have the same problem :P
Please Log in or Create an account to join the conversation.
- Lefteris
-
- Offline
- Moderator
Less
More
- Posts: 8743
10 years 4 months ago #134872
by Lefteris
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by Lefteris on topic How to get Youtube video url
@Wymian
What's exactly your problem?
What's exactly your problem?
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.