Products modules auto ignore video tag Topic is solved

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
duyquyen1710
Forum Members
Forum Members
Posts: 17
Joined: Sat Aug 17, 2013 4:49 am

Products modules auto ignore video tag

Post by duyquyen1710 »

I have a problem with Products module
When i write to Details field of Item products, every html tags working ok but video tags like: iframe, video, embed are ignored. After i click save they're disappeared. May be Products module auto ignore video tags.
How to insert youtube video to Details fied of Products module? Thank you very much!
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3484
Joined: Mon Nov 28, 2011 9:29 am
Location: The Netherlands

Re: Products modules auto ignore video tag

Post by velden »

What about adding a custom field for the Youtube video ID and creating the needed html (iframe, embed, video) in the detail template.
You can make it conditionally (so only if the field has a value).

Think that would have multiple benefits. Like you can change that templated html-code in the future.
duyquyen1710
Forum Members
Forum Members
Posts: 17
Joined: Sat Aug 17, 2013 4:49 am

Re: Products modules auto ignore video tag

Post by duyquyen1710 »

Thank you for your help Velden! Your method i've already used, but it's not flexible because the video is inserted at fixed position in detail tempalte, before or after {$entry->details}. I'm looking for method to insert video tags without ignore of Products module.
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3484
Joined: Mon Nov 28, 2011 9:29 am
Location: The Netherlands

Re: Products modules auto ignore video tag

Post by velden »

I think I should have started with a warning: the Products module is abandoned bij it's developer. Consider this if starting with this module.

Flexibility could be added by using two 'details' fields; one before an optional video and one after.

Another option would be to create a UDT (user-defined tag) which provides an editor with a simple method to insert a Youtube video.
E.g.

Code: Select all

blabla {Youtube id=mCXQ6vJ1Enw} blabla
or

Code: Select all

blabla {Youtube url=https://youtu.be/mCXQ6vJ1Enw} blabla
I stand by the fact that I think you should be able to change the video code when for example YouTube decides it should be completely different. You then don't want to change it in 1000 product details.

BTW: are you sure this behavior is Products-module specific? Or is it the wysiwyg editor doing it? What happens when you add such code to a normal page for example?
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12709
Joined: Thu Mar 09, 2006 5:32 am
Location: Arizona

Re: Products modules auto ignore video tag

Post by Dr.CSS »

Have you tried eval..?
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3484
Joined: Mon Nov 28, 2011 9:29 am
Location: The Netherlands

Re: Products modules auto ignore video tag

Post by velden »

Eval shouldn't be of any help in this case. That's for Smarty, not for disappearing html.
User avatar
DIGI3
Dev Team Member
Dev Team Member
Posts: 1629
Joined: Wed Feb 25, 2009 4:25 am
Location: Victoria, BC

Re: Products modules auto ignore video tag

Post by DIGI3 »

The WYSIWYG will strip out tags, but depending on which one you're using you may be able to add specific tags to the whitelist. Velden's idea of a plugin or UDT is probably a better one though.
Not getting the answer you need? CMSMS support options
duyquyen1710
Forum Members
Forum Members
Posts: 17
Joined: Sat Aug 17, 2013 4:49 am

Re: Products modules auto ignore video tag

Post by duyquyen1710 »

Thanks for your help Velden and Dr.CSS and DIGI3!
I think this behavior is Products-module specific because when i turn off Micro Tiny (Select WYSIWYG to use to none), the video tags are still removed. Another pages video tags working ok.
In my case, i have about 1000 products. With each product i have 0, 1,2 or more videos to describe it and they can be inserted anywhere in product details.
I am currently using the method create there Fields youtube1, youtube2, youtube3 and make it conditionally to be appear
I'm not a coder so there something i don't understand, i make website for my own not for another to use. More than 10 years a go, i've choice cmsms because the text "made simple". And now, i still feel happy with that choice :) !
User avatar
creopard
Forum Members
Forum Members
Posts: 50
Joined: Fri Nov 10, 2017 10:25 am
Location: .de
Contact:

Re: Products modules auto ignore video tag

Post by creopard »

velden wrote: Fri Jul 28, 2023 2:49 pm Another option would be to create a UDT (user-defined tag) which provides an editor with a simple method to insert a Youtube video.
I followed that approach to lazy load YouTube videos (due to cookie law and GDPR).
Using the following JavaScript that does the HTML formatting: https://github.com/creopard/lazy-load-youtube-videos
and a new UDT like

Code: Select all

{youtube_link_lazy id='bDuXLQjaocE'}
UDT "youtube_link_lazy" source code:

Code: Select all

$id = isset($params['id']) ? $params['id'] : '';
if ( !empty($id) ) {
	echo '<div class="wrapper"><div class="llyv" data-id="'.$id.'"></div></div>';
}
duyquyen1710
Forum Members
Forum Members
Posts: 17
Joined: Sat Aug 17, 2013 4:49 am

Re: Products modules auto ignore video tag

Post by duyquyen1710 »

I've found solution. I add a textarea field (custom field), and textarea field don't trip out video tag. It's so simple I didn't think. Thank you very much!
Post Reply

Return to “Modules/Add-Ons”