Jump to content

Recommended Posts

Posted

I did a few searches, however, was not able to find this - so sorry if I am repeating someone else's topic!

Today, I was asked to add an iframe to one of our pages - so we could push into the page data from another solution on the server. When I click on the

 button, and do <iframe ...></iframe> and click update it is removed.

Is there an easy way for a processwire beginner (but am a programmer) to implement support for this? (no idea where to look/tweak).

Thanks a lot!

Ozz

Posted

Welcome ozznixon !

why not add a field to your template an name it iframe_url or something.

Then in your template file:

if($page->iframe_url) {

    echo "<iframe src='{$page->iframe_url}' class='my-iframe'></iframe>";

}

  • Like 2
Posted

Hi ozznixon,

The settings for TinyMCE are located in the field settings for whichever field you want to add this capability to. So, for the body field, go into Setup > Fields > body. Then go to the "INPUT" tab and click on "TinyMCE Advanced Configuration Options".

You'll want to edit the valid_elements to allow for iframes. I don't know off the top of my head how to do this... but if you're okay with allowing ALL elements, you can replace everything in the field with *[*] and that will allow iframes along with everything else. I usually do this although some people would caution against it... It really depends on how much power you want to give your editors.

  • Like 2
Posted

EFC, you were spot on! I appreciated the step by step of how to find the field, once I was there, I figured out what all I needed to implement some of the fields we need.

Thanks again, and for the quick response!

Posted

Glad I could help! Depending on the application, hard coding the iframe into the template or using Martijn's suggestion of adding a new field just for the iframe html could also be a good/better solution. That's the fun part about PW :)

  • Like 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...