Jump to content

Load 'clean' PHP page in iframe


Robin S
 Share

Recommended Posts

I'm working on a module that needs to load a page inside an iframe (inside a CKEditor dialog).

Currently I am loading a plain HTML file and doing all the processing with Javascript, which works fine. But I'm wondering what options are available to me if I wanted to load a PHP/API-powered page in the iframe. PHP files cannot be directly loaded inside /site/, so I thought about the following options to work around this. I'm keen to get any advice about which would be best and any other solutions.

1. Have my module copy a PHP file to the root directory, where PHP files may by loaded. This file could then bootstrap PW. This option seems messy - I don't think it's good for a module to copy files to the root.

2. Make a Process module that creates a hidden page under Admin. The problem I'm finding with this is that it's difficult to avoid visible admin template elements being rendered in the page. This is similar to what @blynx was asking about here. I can append 'modal=1' to the URL to avoid the admin header and footer (I think that is what @horst's modules do) but I'm finding that message notifications (e.g. compiler notifications) can still appear and I don't want them in my iframe. Is there another URL parameter (or a hook maybe) that I can use to prevent notifications?

3. In the install() method of my module, create a new template and a new page and assign the template to the page. I wouldn't want my template file in the /site/templates/ directory but I figure there is a way to assign a template file that is inside my module directory. This option seems like it will work, but it involves more code for the page/template creation and deletion on uninstall than the elegance of the automatic page options for a Process module.

4. Some kind of hook to page render that prevents the normal admin template markup and outputs my custom markup instead. I guess with this option I wouldn't even need a page - just look for some GET variable in the URL. Would this be a good solution?

Any other suggestions for how I can load a clean page with access to PHP and the PW API?

P.S. It isn't a negative for the loaded page to be using the admin template if I can find a solution to the notifications issue as part of the objective is to use the jQuery version and inputfield styles that come with the admin theme.

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...