ElkArte Community

Project Support => Support => Topic started by: anagnam on October 19, 2015, 09:02:05 am

Title: Display iframe code result on post
Post by: anagnam on October 19, 2015, 09:02:05 am
Hello again Devs,

Is it possible to display the iframe code in the post? No, not as code snippet but as actual iframe code result.

thanks once again in advance  :)
Title: Re: Display iframe code result on post
Post by: Wizard on October 19, 2015, 09:08:12 am
I guess, you need to enable HTML BBC tag in editor to do that. Let me warn you, it is not something I would advise for non admin users.
Title: Re: Display iframe code result on post
Post by: anagnam on October 19, 2015, 09:38:49 am
thanks @Wizard, where exactly can I find that setting so I can enable it.
Title: Re: Display iframe code result on post
Post by: Wizard on October 19, 2015, 09:40:47 am
I am not sure. It must be under BBC settings. That means somewhere in post or topic settings.
Title: Re: Display iframe code result on post
Post by: anagnam on October 19, 2015, 09:47:36 am
@Wizard I found where to enable it. Its under Forum > Posts and topics > BBC. Unfortunately it doesnt work even if its enabled.
I mean the BBC work but for basic HTML markup only. not for iframe.
Title: Re: Display iframe code result on post
Post by: Wizard on October 19, 2015, 09:50:07 am
You need to wrap the iframe in
Code: [Select]
[html] iframe code here [/html]
tag.
Title: Re: Display iframe code result on post
Post by: anagnam on October 19, 2015, 12:43:12 pm
@Wizard its still not working unfortunately.
Title: Re: Display iframe code result on post
Post by: Wizard on October 19, 2015, 01:56:58 pm
It should, provided

1. You have enabled use of HTMLin editor

2. You have use the [html] [/html] to wrap the iframe code

Check and confirm if these are met. If still not working, I am not sure why.

You can alternatively see the user group permissions, whether it allow use of html on editor even if you allowed in BBC settings.
Title: Re: Display iframe code result on post
Post by: emanuele on October 19, 2015, 02:40:51 pm
The HTML tag was removed from ElkArte since... I think 1.0.1 for security reasons.
Use HTML is a security risk.
There is an addon the restores the HTML tag, but I would suggest to consider explaining why you need to post an iframe and investigate if there are better solutions.
Title: Re: Display iframe code result on post
Post by: anagnam on October 20, 2015, 01:36:44 am
Hi @emanuele the reason I want to use an iframe on a post is because Im running an educational forum where I give each lessons as a separate posts. There is one lesson (1 post) that I want to display an iframe widget from a third-party site so I can explain it further. I hope we could come up with an addon just for this purpose if its now possible to do so. As always, any ideas on how I can achieve this goal is greatly appreciated.
Title: Re: Display iframe code result on post
Post by: Wizard on October 20, 2015, 02:31:10 am
I too used to think ways to use <iframe></iframe>. Wish they simply uploaded the YouTube video.
Title: Re: Display iframe code result on post
Post by: emanuele on October 20, 2015, 08:18:11 am
For youtube you just have to use the url of the video, no need for iframes.
Title: Re: Display iframe code result on post
Post by: anagnam on October 21, 2015, 01:00:58 am
@emanuele can I use the same principle as the youtube where I will just provide a link and it will be automatically iframes exactly the same iframe code I got from the third-party vendor? Maybe if I could duplicate the same functionality for the youtube so I can create the same functionality for my own use. Is it possible?
Title: Re: Display iframe code result on post
Post by: Joshua Dickerson on October 21, 2015, 01:19:38 am
You need to give more information about what you're trying to do.
Title: Re: Display iframe code result on post
Post by: anagnam on October 21, 2015, 01:39:37 am
@emanuele @Joshua Dickerson please refer to the attached image. In the left is the iframe code and on the right is the preview. I want to embed that iframe in the post so I can explain what is all about and the user can actually see the live widget and interact on it. Can it be done? many thanks again in advance.
Title: Re: Display iframe code result on post
Post by: Joshua Dickerson on October 21, 2015, 01:54:48 am
It can be done, but it's a mod. It would be a security issue to allow anyone to add an iframe on your site. So, it would need to be limited to admins. Because of that, it requires a mod... which I don't want to write.

You'll need to look at parse_bbc() in Subs.php and get a pretty good idea of how it all works.
Title: Re: Display iframe code result on post
Post by: Wizard on October 21, 2015, 02:32:06 am
May be an addon to enable only iframe attribute in HTML.
Title: Re: Display iframe code result on post
Post by: anagnam on October 21, 2015, 03:57:06 am
@Joshua Dickerson I know a little bit of php (still a newbie) so if you could point me to the right direction, I could probably  take a shot. thanks
Title: Re: Display iframe code result on post
Post by: Joshua Dickerson on October 21, 2015, 04:32:58 am
You need to either do it in preparsecode() or check it in there and do it in parse_bbc(). It's not a simple mod because it requires permissions to do it. If you are new to PHP/Elkarte, I doubt you have the skills or knowledge to do it right now without a lot of help. Sorry, I don't have time to do this.
Title: Re: Display iframe code result on post
Post by: emanuele on October 21, 2015, 08:10:04 am
First few random questions: any user have to be able to do that? Do you need it on "several" topics, or it's just a "one-topic" thing to explain how to use the calculator?
In one case (i.e. multiple users and/or multiple times) it would be worth write an addon for the specific topic. But if you need it just one time (or very few times) to explain how to use the form, then use the BBC html addon you can find at http://addons.elkarte.net/