Topic: Youtube videos

Hello, I have a question regarding cutenews with Youtube ...

To put videos on the page, you have to insert the code [Youtube] video link [/ Youtube] since the other code to insert me nothing comes ...

The problem with this code is that the video is in the original size of the video and because of my web design is not good, since I need to do the narrowest video.

But I do not know how! And I find nothing on the net.

Could someone help me??

thanks

Re: Youtube videos

Could you kindly give us an example and screenshotы for us to understand the problem in a better way.

Best regards,
CN Support team

3 (edited by 2014-02-01 10:40:48)

Re: Youtube videos

Hello, I have a question regarding cutenews with Youtube ...

To put videos on the page, you have to insert the code [Youtube] video link [/ Youtube] since the other code to insert me nothing comes ...

The problem with this code is that the video is in the original size of the video and because of my web design is not good, since I need to do the narrowest video.

But I do not know how! And I find nothing on the net.

Could someone help me??

thanks

There are two ways to do this.

1. Get the embed code from youtube and click Source to insert it into your news then change the values of the embed code:
    <iframe allowfullscreen="" frameborder="0" height="359" src="//www.youtube.com/embed/example?feature=player_detailpage" width="640"></iframe></p>

or

2. Resize the video using the drag handles visible at each corner after inserting the embed code

Re: Youtube videos

The problem is that when I type the code you copied from youtube, the video is not in the news. the code just disappears.

For videos I use the code I mentioned above, so you do see, but you can not change the size ... And the average size is larger than the design of my website.

5 (edited by 2014-02-01 21:04:11)

Re: Youtube videos

Add additional fields:

Field type: Text
Name: Videopost
Description: Youtube Video


HTML code template:  (variant 1)

<div class="PostFullStoryVideo" data-videopost="{videopost}"></div>


Jquery script:

<script type="text/javascript">
$(document).ready(function() {
    var getvideoidpost = $('.PostFullStoryVideo').attr('data-videopost');
    $(this).html('<iframe width="540" height="304" src="//www.youtube.com/embed/' + getvideoidpost + '?rel=0&autoplay=1&showinfo=0&controls=1&HD=1" frameborder="0" allowfullscreen></iframe>');
});
</script>


Or without script simple html: (variant 2)


HTML code template:

<iframe width="540" height="304" src="//www.youtube.com/embed/{videopost}?rel=0&autoplay=1&showinfo=0&controls=1&HD=1" frameborder="0" allowfullscreen></iframe>

Re: Youtube videos

A quick fix is to get the embedded code of the video from YouTube and then change the width and height to the one you want. Copy and paste the iFrame HTML code and put it in your news. Remember to tick "Enabled HTML" at the bottom before you add the news.

This is if you are using CuteNews 2.0.

Re: Youtube videos

No way, but thanks.
I will try to modify the design to make it bigger:

8 (edited by 2014-02-10 16:52:15)

Re: Youtube videos

Add additional fields:

Field type: Text
Name: Videopost
Description: Youtube Video


HTML code template:  (variant 1)

<div class="PostFullStoryVideo" data-videopost="{videopost}"></div>


Jquery script:

<script type="text/javascript">
$(document).ready(function() {
    var getvideoidpost = $('.PostFullStoryVideo').attr('data-videopost');
    $(this).html('<iframe width="540" height="304" src="//www.youtube.com/embed/' + getvideoidpost + '?rel=0&autoplay=1&showinfo=0&controls=1&HD=1" frameborder="0" allowfullscreen></iframe>');
});
</script>


If you're going to do that, the extra custom field isn't really necessary. Plus, you'd have to put <div> for the video in the template, which isn't optimal because you can't really chose where it goes in the news post (if you want to have text before/after the video).

Something better would be to have the following code in your news post (html enabled) where you want the video:

<div class="newsYoutube">ocW3fBqPQkU</div>


And include on the page (not in the news post/template; we only need it once):

<script type="text/javascript">
$(document).ready(function() {
    $(".newsYoutube").each(function(){
        $(this).html('<iframe width="560" height="315" src="//www.youtube.com/embed/'+ $(this).html() +'?rel=0" frameborder="0" allowfullscreen></iframe>');
    });
});
</script>


You could still use the data-videopost="youtubeidhere", but I prefer putting it into the div so it gets replaced (also, less code). Having the attribute after we've embedded the video isn't needed. Also, we don't really need to create a javascript variable for the youtube id; we're only using it once.

This is fine and all, and it kind of fixes the problem, but the deeper problem is not being able to embed any kind of HTML into the news posts that you want. It's not like you're going to insert anything malicious, it's your own website. I use HTML in a lot of my news posts, especially because the bbcode doesn't really work for certain things. Like links, for example. If I had multiple links, the [/link] wouldn't end the link, and it would only end once it got to another [link=http://.....], etc.

Also worth noting that if you want to add new lines, you have to use
, which isn't valid html. You should be using <br/>, but it just gets replaced by a new line, but the new line won't show in the news post (on the site) because you have html enabled. I tried doing
</br>, but then it did two new lines, instead of just one.

The HTML and bbcode in Cutenews 2 need fixin'. Also, you should be able to set the specific width/height for your embedded videos. Something like:

[youtube=560,315]URL[/youtube]


Where the first number is the width, and the second is the height.

EDIT: I realized that the jQuery I had conflicted if you had multiple videos on the same page. The code should now work for multiple videos on the same page.

9 (edited by 2014-02-27 19:30:38)

Re: Youtube videos

Add additional fields:

Field type: Text
Name: Videopost
Description: Youtube Video


HTML code template:  (variant 1)

<div class="PostFullStoryVideo" data-videopost="{videopost}"></div>


Jquery script:

<script type="text/javascript">
$(document).ready(function() {
    var getvideoidpost = $('.PostFullStoryVideo').attr('data-videopost');
    $(this).html('<iframe width="540" height="304" src="//www.youtube.com/embed/' + getvideoidpost + '?rel=0&autoplay=1&showinfo=0&controls=1&HD=1" frameborder="0" allowfullscreen></iframe>');
});
</script>

Or without script simple html: (variant 2)
HTML code template:

<iframe width="540" height="304" src="//www.youtube.com/embed/{videopost}?rel=0&autoplay=1&showinfo=0&controls=1&HD=1" frameborder="0" allowfullscreen></iframe>



Hi

Maybe I'm missing something, but I cn't see just how to implement this so the video is actually embedded in the news - when I hit Edit the video just disappears...

10 (edited by 2014-03-03 21:28:02)

Re: Youtube videos

Hi

Maybe I'm missing something, but I cn't see just how to implement this so the video is actually embedded in the news - when I hit Edit the video just disappears...

That's right. I tried it too, but half of the script / code just disappears.
And with BBCode I can't change the size of the video....

11 (edited by 2014-07-20 19:14:32)

Re: Youtube videos

I have a simple way to solve this problem.


Just open the file -> "core" -> "news.php"


And then go on line 192

and change the youtube video size settings how ever you want them.

<iframe width="450" height="310" src="http://www.youtube.com/embed/'.$yt_url.'?feature=player_detailpage" frameborder="0" allowfullscreen></iframe>';

and at the end don't forget to upload "news.php" again after you changed it.  https://cutephp.com/forum/style_emoticons/default/smile.gif

xoxo

Melissa