Post by AD02143 » Mon Feb 12, 2018 6:25 am

Hi all,
I'm trying embed a youtube video to only one information page in Opencart 3.0.2.0
I want the video to adjust to the width of the page so I've
added this to the stylesheet.css file:
.container1 {
position: relative;
width: 100%;
height: 0;
padding-bottom: 56.25%;
}
.video1 {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}

After that, I updated the information.twig file with:
(Note: That's just an example video.)
<div class="container1">
<iframe src="https://www.youtube.com/embed/1RAwXtVr0U4?" frameborder="0" allowfullscreen class="video1"></iframe>
</div>

Video adjusts perfectly.
Problem is that it's showing on every information.twig page.
I've been fiddling with if statements with no luck.
I'm new to this and can't figure it out.
It's frustrating because, I'm guessing this is very easy.
I read something about updating a variable with the current page on the controller file.
Then doing an if statement on the information.twig file.
Don't know what a controller file is.
Any help here would be so great..
Thank you..

Newbie

Posts

Joined
Fri Oct 27, 2017 2:22 pm

Post by ashon » Mon Feb 12, 2018 7:49 am

AD02143 wrote:
Mon Feb 12, 2018 6:25 am
Hi all,
I'm trying embed a youtube video to only one information page in Opencart 3.0.2.0
I want the video to adjust to the width of the page so I've
added this to the stylesheet.css file:
.container1 {
position: relative;
width: 100%;
height: 0;
padding-bottom: 56.25%;
}
.video1 {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}

After that, I updated the information.twig file with:
(Note: That's just an example video.)
<div class="container1">
<iframe src="https://www.youtube.com/embed/1RAwXtVr0U4?" frameborder="0" allowfullscreen class="video1"></iframe>
</div>

Video adjusts perfectly.
Problem is that it's showing on every information.twig page.
I've been fiddling with if statements with no luck.
I'm new to this and can't figure it out.
It's frustrating because, I'm guessing this is very easy.
I read something about updating a variable with the current page on the controller file.
Then doing an if statement on the information.twig file.
Don't know what a controller file is.
Any help here would be so great..
Thank you..
if your trying to add a video to a information page then you can do this within the cpanel just go to catalog > information > Your Page > then you select the video bbcode and put link in,
http://prntscr.com/ide2nx

New member

Posts

Joined
Sat Apr 18, 2015 2:18 am

Post by AD02143 » Tue Feb 13, 2018 8:33 am

Thank You Ashon,
Yes, but as I wrote in my post, I'm not only trying to add a video.
"I want the video to adjust to the width of the page".
That's why I updated the css file as I did and updated the information.twig file.
I don't believe your suggestion meets those needs...

Newbie

Posts

Joined
Fri Oct 27, 2017 2:22 pm

Post by AD02143 » Sat Feb 17, 2018 1:08 pm

Can anyone help me with this problem?

Newbie

Posts

Joined
Fri Oct 27, 2017 2:22 pm

Post by pprmkr » Sat Feb 17, 2018 3:30 pm

Goto Catalog - Information
Edit the information page
Click </> Codeview
Paste:

Code: Select all

<div class="col-xs-12 embed-responsive embed-responsive-16by9">
	<iframe frameborder="0" src="//www.youtube.com/embed/ZDhnVPB8ev0?autoplay=1&amp;loop=1&amp;playlist=ZDhnVPB8ev0&amp;showinfo=0&amp;theme=light&amp;color=white&amp;controls=0&amp;modestbranding=1&amp;start=1&amp;fs=0&amp;iv_load_policy=3&amp;wmode=transparent&amp;rel=0"></iframe></div>
Note: Replace ZDhnVPB8ev0 by embed code from movie you want to embed.

User avatar
Active Member
Online

Posts

Joined
Sat Jan 08, 2011 11:05 pm
Location - Netherlands

Post by straightlight » Sat Feb 17, 2018 10:56 pm

I don't believe your suggestion meets those needs...
If you are looking for specific needs, that can be done as a custom job, simply create a new topic in the Commercial Support section of the forum.

The most generated errors being found on Opencart forum originates from contributed programming. The increased post counters are caused by redundancies of the same solutions that were already provided prior.

F. Rules:

- viewtopic.php?f=176&t=200480
- viewtopic.php?f=176&t=200804


Regards,
Straightlight


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by AD02143 » Sun Feb 18, 2018 1:11 am

Thank You straightlight.. I'll do that now.

Thanks for your reply pprmkr.
However, copying that code into the information page comes up blank once you save.
I wish that it didn't because that seems like it would be the solution.
Do you have any idea why it can't be saved?

Newbie

Posts

Joined
Fri Oct 27, 2017 2:22 pm

Post by pprmkr » Sun Feb 18, 2018 1:29 am

When you are in Code view mode and paste the embed code, press button Code view again.
Only then Summernote processes the new code and you'll see the result in the WysiWyg editor.

User avatar
Active Member
Online

Posts

Joined
Sat Jan 08, 2011 11:05 pm
Location - Netherlands

Post by AD02143 » Sun Feb 18, 2018 2:29 am

Thank You so much!
That was the answer..!!

Newbie

Posts

Joined
Fri Oct 27, 2017 2:22 pm
Who is online

Users browsing this forum: Baidu [Spider] and 24 guests