Jump to content

Custom process module should return data without admin-interface html data, possible?


blynx
 Share

Recommended Posts

Hej,

I am working on a Process Module which should display an html template in an iframe which I want to put through wirePopulateStringTags().
So I thought I'd set the src of the iframe to an executeIframe() function of that Process - but that would of course return the whole admin page.

Is there a way to surpress the rendering of the admin interface and just send back the html file? I don't want to set up a page with a seperate template in the page-tree just for that feature.

Otherwise I guess I'd make a helper php script ... Or does anyone have another idea?

Cheers,
Steffen

 

Link to comment
Share on other sites

I'm sure you can do something with the ready() method to manually return a response. Perhaps you could even implement a router to handle this? I'm using nikic/FastRoute for the new iteration of Jumplinks. It can also be used for this kind of thing, I am sure. Or perhaps there's another way I don't know about - someone else will chime in if there is.

Link to comment
Share on other sites

Hej Mike,

thanks for your response!

So, I'd use the ready-function-approach like echoing my data and then die() to prevent loading execute() and all the rest?
Will have a look at the router and your implementation later - sounds interesting -

Link to comment
Share on other sites

I'm not very familiar with the process pages, but every time I used it, there was no Adminpage involved. ? ???

If you have a look at the ProcessCropableImage3 module, it previous opened in a blank tab, and now in a modal window. But only contains it own content.

There is made use of a HTML-template with PHP-vars, what gets populated when rendering.

There is no need for templates or pages in the pagetree.

  • Like 1
Link to comment
Share on other sites

Hi @horst!

Hmmm - when I access an admin page with a process like "http://domain.de/processwire/customadmin" the output of execute() will be put into the admin interface - How are you accessing/displaying those pages? Where can I find the place where the modal windows gets created/called? Couldn't find it right now ...
 

Link to comment
Share on other sites

For a croppable image edit page (the old modul version) opening in a new window is used:

<a href="http://localhost/processwire/page/croppable-image/?filename=scheuermann_aussen.jpg&suffix=cropname&width=780&height=190&pages_id=1&field=header_images" target="_blank">cropname</a>

 

Opening in a modal I now use:

<a href="http://localhost/processwire/page/croppable-image-3/?filename=scheuermann_aussen.jpg&suffix=cropname&width=780&height=190&pages_id=1&field=header_images&modal=1">cropname</a>

 

The page / croppable-image is a Processpage that get created during module ___install() routine.

  • Like 1
Link to comment
Share on other sites

Hej!

Aha!

Thanks @horst for the hints, I found out that simply providing the "modal=1" GET variable will render any process page without the processwire interface. Leaving it out you will see the process inside processwire.

Clever thing ...

Cheers,
Steffen

EDIT:

ok ... the modal version still has processwire <head> and stuff - so that's not what I want.
I found another solution for my problem (maybe even better), but if anyone has any idea how to completely replace the markup from the admin page, let me know!

  • Like 1
Link to comment
Share on other sites

Hi apeisa,

actually I am using a template file now - because I "found out" that the stuff I want to render gets the data from a page under that process and they exist anyway. ... Too obvious ... 

Still, I'd like a solution where I wouldn't have to move some template file from that module into the site/templates folder. Feels kinda like "pollution" for me.

Wonder if it is possible to trick processwire into thinking a page without template file actually has one and tell it to take a file from the module folder?
 

Link to comment
Share on other sites

Thanks horst for the list and for pointing things out!
But I think this doesn't fit my needs?

I want to display that template in an iframe which should not have any processwire markup added. The modal mode removes the processwire interface but still includes pw css, js, header, this and that…

But I also found another reason for copying the template file into site/templates - it might be useful to edit that file and modify the rendering of those pages.

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