External pages in XenForo overlays?


Active member
How can I open another page in an xenforo overlay? What code should I use?

I also want it to be a callToAction button that opens it up.
Wait it doesn't work because the overlay is tiny and can't display anything....

Trying to test by loading Google: http://puu.sh/1zaBE
You'll need to make edits via css to display the contents of the iframe as whatever size you like. Here's the contents of my overlay.php

if (!isset($_GET['url']) || !isset($_GET['_xfResponseType']) || $_GET['_xfResponseType'] != 'json')
    header('HTTP/1.1 404 Not Found');
    echo 'Invalid parameters.';
    $url = $_GET['url'];
    $data = array(
        'templateHtml' => '<form id="DemoOverlay" class="xenForm formOverlay"><div class="DemoContainer"><iframe style="width:620px; height:490px; border-width: 0; border-style: none;" src="' . htmlspecialchars($url) . '"></iframe></div></form>',
        'css' => '',
        'js' => '',
        'title' => isset($_GET['title']) ? $_GET['title'] : 'Like JPiC Forum on Facebook',
    echo json_encode($data);

You'll notice the width/height attributes are defined. You could likely add the style to your EXTRA.css and define the iframe class. That'd make the code tidier.

Then call the overlay.php by similar html code in your template:

<a href="http://jpicforum.info/facebook/likebox.html" title="Like JPiC Forum" data-href="overlay.php?url=http://jpicforum.info/facebook/likebox.html" class="OverlayTrigger navlike"/>

HTH ;)

Top Bottom