Jump to content

[SOLVED] Call Custom Field Containing iFrame Code


ridgedale
 Share

Recommended Posts

Reference: PW 3.0.62 and uikit3 based site using the Regular-Master profile.

I wonder if anyone might be able to assist. I've setup a custom field to allow contributors to enter the html code to display an iframe.

When I try to call the field nothing is displayed:

echo $page->get("/contact")->urliframecode;

When I inspect the element nothing is being passed to the web browser. If I enter the code directly in the template, the iframe is displayed correctly.

I've tried configuring the custom field has been configured as type text area and as both Unknown/Text as well as Markup/HTML without any success.

Any idea where I am going wrong?

 

Edited by ridgedale
Solution found
Link to comment
Share on other sites

Hi kongondo,

Thank you for the reply and the topic link. My searches did not uncover that thread. A lot of my searches tend to return zero results, possibily because I'm entering too much information. :(
It was very helpful to be aware of the potential issues in relation to allowing contributors/users the ability to enter code into fields. :)

Having read through it all I decided to replace the field I setup to hold the iframe code with two fields the contributors can copy and paste the relevant URLs within the iframe code into them as the remainder of the iframe code is identical and it avoids any potential the security issues. Then I needed to do was replace the URLs in the iframe code on the template with the processwire code to load the data from the fields.

Many thanks again.

Link to comment
Share on other sites

19 minutes ago, ridgedale said:

My searches did not uncover that thread. A lot of my searches tend to return zero results,

Seems like you are using the forum's inbuilt search function? It's not the best. Try google, e.g. iframe site:processwire.com/talk/ OR this CSE (the one in my signature) OR...there are other similar ones (including a plugin) in the forums. Can't find it now :P.

21 minutes ago, ridgedale said:

Having read through it all I decided to replace the field I setup to hold the iframe code with two fields the contributors can copy and paste the relevant URLs

Are the URLs dynamic or set some place? You could save your editors some copying and pasting by having those ready-made and selectable in some inputfield, e.g. Fieldtype Options. I don't know you setup so my suggestion might not be appropriate. Just a thought.

Link to comment
Share on other sites

26 minutes ago, kongondo said:

Seems like you are using the forum's inbuilt search function? It's not the best. Try google ...

That's exactly what I have been doing ... searching the forums using the built-in search then following up with a Google search. :(

27 minutes ago, kongondo said:

OR this CSE (the one in my signature) OR...there are other similar ones (including a plugin) in the forums.

I'll give that a try and have a hunt round the forums. Thanks. :)

28 minutes ago, kongondo said:

Are the URLs dynamic or set some place?

The iframe contains OpenStreetMap data. The contributors/users just need to follow the instructions how to add a location map for their group. The locations could be anywhere. If no URLs are entered, that section of code is ignored.

Hope that makes sense. Thanks again for your assistance.

 

Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...