Jump to content

[Resolved] Embedding Youtube


Galwyn

Recommended Posts

  • 1 month later...

Creating an <iframe> in the product's description can be done, as there is a toolbar button (second row, far right, looks like a globe) to insert the <iframe>.

The editor pops up a dialog box asking for the <iframe> details of the source document. That tells me the <iframe's> source document will have to be constructed by you, containing whatever code is necessary to launch the Youtube viewer.

I would have to assume the plugin has completed all this prep work and all you need then is the video ID and to decide where to show the video. From the plugin product images, I see it can be placed in the Category, Product, and Document (including Homepage document) area. The plugin might be able to be modified to put a video other places, like the Registration page or, Checkout pages.

Link to comment
Share on other sites

On 6/27/2016 at 6:04 PM, bsmither said:

Creating an <iframe> in the product's description can be done, as there is a toolbar button (second row, far right, looks like a globe) to insert the <iframe>.

The editor pops up a dialog box asking for the <iframe> details of the source document. That tells me the <iframe's> source document will have to be constructed by you, containing whatever code is necessary to launch the Youtube viewer.

I would have to assume the plugin has completed all this prep work and all you need then is the video ID and to decide where to show the video. From the plugin product images, I see it can be placed in the Category, Product, and Document (including Homepage document) area. The plugin might be able to be modified to put a video other places, like the Registration page or, Checkout pages.

Thank you for your reply. Yes, that button you mentioned is the one was trying to use with the embed code from the Youtube video, which would not work for me. But I somply took that same mentioned above embed code and and inserted it in the source code for the product description and the video player was there on the front end. I should have thought of that in the first place.

Thanks again,

-Joe

Link to comment
Share on other sites

  • 8 months later...

I've never tried this before, but I wanted to add the live feed of April the Giraffe to a Featured Giraffe Plush special category.

Here's what Youtube shows as the embed code:

<iframe width="560" height="315" src="https://www.youtube.com/embed/XQDbOJRNZx8" frameborder="0" allowfullscreen></iframe>

I've tried adding it as-is in Source Code, but I get a blank page that says ./error.html up in the top left corner when I try to save.

So I tried again using the Globe and putting the url and the size information from the embed info into the popup that comes up when I click the globe. I get the same dot slash error.html code.

This is with 6.1.5 code.

Link to comment
Share on other sites

I don't get that. The edited product description saved.

I get the <iframe> when viewing the product. (I don't let things like this actually run, so I get a black box that says, "An error occurred. Watch this video on Youtube.")

Create the error_log and maybe there is a clue.

Link to comment
Share on other sites

It saves in a product description without issue. But I can't get it to save in the Category description. Does that give you any idea what I have wrong? Or is this the reason SemperFi has the plugin - this won't work for every document box??

Trying to figure out a different approach to what I want - is there a way to specify code in content.category.php that will show only in category=173? I briefly tested adding the embed code straight into content.category.php, and it shows correctly - but of course it's at the top of EVERY category.

Link to comment
Share on other sites

Hi Alex.

Are you trying to add the feed to a category description.

I had a little play with my test site, I can add the feed inside a product description, but not inside a category description

 

I see

 

Forbidden

You don't have permission to access /adminxyz.php on this server.

Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request.

I just watched my apache log and saw this.. It looks like mod security doesn't like it.

Sort of explains why I can't embed it.

 

[Tue Mar 14 15:34:17 2017] [error] [client xx.xx.xx.xxx] ModSecurity: Access denied with code 403 (phase 2). Pattern match "< {0,1}iframe" at ARGS:cat[cat_desc]. [file "/var/cpanel/cwaf/rules/07_XSS_XSS.conf"] [line "96"] [id "212280"] [rev "1"] [msg "COMODO WAF: Cross-site Scripting (XSS) Attack||www.domain.co.uk|F|2"] [data "Matched Data: <iframe found within ARGS:cat[cat_desc]: <p>this is a test category setup during install. it can be edited or deleted from the store admin control panel.</p> <p><iframe frameborder=\\x220\\x22 scrolling=\\x22no\\x22 src=\\x22http://www.domain.co.uk/test-category/test-product.html\\x22></iframe></p> "] [severity "CRITICAL"] [hostname "www.domain.co.uk"] [uri "/admin_xyz.php"] [unique_id "WMgNedWr3R8AACzCAC4AAAAM"]
Link to comment
Share on other sites

2 minutes ago, keat said:

Are you trying to add the feed to a category description.

Yes, that's what I wanted. But I don't mind hard coding the video code in content.category.php, as long as there is a way to limit it to that one category with some kind of if/then. There's something of an internet fad going on at the moment of people watching this giraffe on a live feed in the Animal Adventure Park in NY. She is very close to giving birth. There will be a naming contest after the calf is born.

Since we have about 100 listings in our store for giraffes, I figured I'd try to market to those people as long as the craze lasts.

Link to comment
Share on other sites

The difference between a product's description and a category description is only in the name of the key that is being POSTed:

Product has "description" (and "description_short", but that's not important)

Category has "cat[cat_desc]"

Perhaps the mod_security has an exemption for a POST key of "description".

 

Link to comment
Share on other sites

What I have in mind, since the category description does not allow me to embed that way - is something like this concept:

{if $cat_id=173}
<br>
<iframe width="560" height="315" src="https://www.youtube.com/embed/XQDbOJRNZx8" frameborder="0" allowfullscreen></iframe>{/if}
<div id="ccScroll">  

The if does not work, because I have no idea how to set the braces, quotation marks, parentheses, etc. So right now it shows up on every category when my code is there. But this is what it looks like on the Giraffe category (173) that I would like:

aprilgiraffescreenshot.jpg.8a3bab11826da46a69a8de643e2097c1.jpg

Link to comment
Share on other sites

Your statement will always resolve to true. But, you are using {$cat_id} when the correct variable is {$category.cat_id}.

{if $category.cat_id eq 173}iframe stuff{/if}

Smarty allows for the comparison operator eq in place of PHP's comparison operator ==.

Your statement uses a single equals sign which is PHP's assignment operator. You are attempting to make $cat_id contain the value 173. The question is: will $cat_id acquire the value 173? The answer is: (probably) yes. (But that's not how Smarty works, so...Hm,?) Thus, this expression resolves to true.

 

Edited by bsmither
Link to comment
Share on other sites

It works!! FANTASTIC! I had tried $category.cat_id at one time, but couldn't work out the right syntax. THANK YOU @bsmither!!!

Now to work on the parameters that are keeping it from being responsive. I tried taking off the height and making the width 100%, but that didn't work.

I ended up with

{if $category.cat_id eq 173}
<center>
<iframe width="350" height="197" src="https://www.youtube.com/embed/XQDbOJRNZx8" frameborder="0" allowfullscreen></iframe>
</center>
{/if}
<div id="ccScroll">

And you can see the result here:

https://dirtybutter.com/plushcatalog/plush-giraffes.html

Link to comment
Share on other sites

  • 6 months later...

DB, Seems you have taken the video down, as I can not see it. I am wanting to embed a video in the document file instead of the three pictures using bxslider.  I used:

<div class="flex-video">
                        <iframe width="500" height="213" src="https://www.youtube.com/embed/tioF5sFBBJg" allowfullscreen></iframe>
                    </div>

it works but it does not autoplay. 

Edited by harrisorganic
Link to comment
Share on other sites

Yes, it's down now. The zoo stopped streaming all the time. The code to get mine to autoplay was included in the embed code from them. Maybe it will work for you:

<iframe width="350" height="197" src="https://www.youtube.com/embed/FyEtJgL552Y?ecver=1"rel=0&autoplay=1" frameborder="0" allowfullscreen></iframe>

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...