I have a basic module that parses a JSON feed, stores it in cache, then shows a "gallery" of the objects - I know I should have maybe stored these as Nodes but it was supposed to be a quick simple module...

Anyway, it works well except, when I click on one of the objects in the gallery, I have it linked to an "iFrame" (which I cached too, but it's not really a real page) found at: the_page?iFrame-id="theDataID" - these all popup in ColorBox and the HTML from the cache for the "iFrame" is displayed.

This worked well on the dev site, however for the production site - it uses different modules and templates (which I didn't have access to for setting up the dev site).

Now when you click on an object, the ColorBox popup shows the data, except it then shows the original pages' content and I haven't been able to figure out why it does that. I assume the prod site must try to always load the "original content" based on the URL and therefore "ignores" the ?iFrame-id part?

So basically, in my code for the iFrame, I do:

echo $data;

Which causes the data to be printed above the normal pages' content in the popup. So I changed it to:

return $data;

But that caused the data to show up as the pages' content, and I still had the header/footer for Drupal.

Anyone have any ideas?

Another way I could do this is by using ColorBox's inline option instead of the iframe option, however I assume that would require all the data for the objects to be on the page? As right now, the content is loaded dynamically on popup (it doesn't exist anywhere in the DOM before hand).

1 Answer 1


OK, so originally I had tried echo $data; then return;

I then tried: return $data; but that kept showing the header/footer.

I've found that this works well:

echo $data;

Though it's probably not the best way to do it, but it works for the way the module was wrote... should really use the Node/Entity API next time :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.