Hi there,
I would like to display a node or an admin page in a shadowbox but the drupal's pages (ex:mysite.com/node/2 or mysite.com/node/add/contentType) don't have any extensions like .php or .html, so the shadow box won't open when I click on my link.
Is there a solution?

Thanks a lot.

Comments

psynaptic’s picture

Status: Active » Fixed

Doesn't matter if they don't have the right extension. They just open as iframe.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

BWPanda’s picture

Title: how to display a node in the shadowbox? » How to display a node in shadowbox?
Component: Code » Documentation
Status: Closed (fixed) » Active

Are you able to provide some more info on this?

I'm trying to do the same thing (display a node in a Shadowbox popup), but when using the following code: <a href="/admin" rel="shadowbox">Admin</a>, the page opens normally...

I'm using the latest 3.x-dev and would appreciate any assistance with this.
EDIT: I've also enabled all options under the 'Supported Media' setting.

P.S. If it's possible, I'd like to find out how to display just the node in Shadowbox, not the rest of my site (header, navigation, sidebars, etc.) around it.

yoda-fr’s picture

hello,
here is what I have done :

in shadowbox.js:

ext: {
img: ['png', 'jpg', 'jpeg', 'gif', 'bmp'],
swf: ['swf'],
flv: ['flv'],
qt: ['dv', 'mov', 'moov', 'movie', 'mp4'],
wmp: ['asf', 'wm', 'wmv'],
qtwmp: ['avi', 'mpg', 'mpeg'],
iframe: ['','asp', 'aspx', 'cgi', 'cfm', 'htm', 'html', 'pl', 'php',
'php3', 'php4', 'php5', 'phtml', 'rb', 'rhtml', 'shtml',
'txt', 'vbs']
}
just add '' in iframe extensions

to only display th enode content, use a special page template.
exemple in garland :

in your link:
a class="option" href="/your/link?pop=TRUE" rel="shadowbox;width=800;height=600" title="your title"

in template.php:
function phptemplate_preprocess_page(&$vars) {
$vars['tabs2'] = menu_secondary_local_tasks();

// Hook into color.module
if (module_exists('color')) {
_color_page_alter($vars);
}

if (isset($_GET['pop']) && $_GET['pop']){
$vars['template_file'] = 'page-popup';
}
}

create a page-popup.tpl.php in your theme directory and put what you want to display in.

Hope it will help !

psynaptic’s picture

That's the method I use. It's a bit messy as it bootstraps Drupal and includes scripts etc. like admin_menu (which can be surpressed). It is however flexible enough to work with any content and includes the stylesheets so looks just like your site.

I'm not sure of the "proper" (efficient) solution that includes CSS styles but doesn't bootstrap Drupal (seems a bit redundant).

psynaptic’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

ssquirrel’s picture

in your link:
a class="option" href="/your/link?pop=TRUE" rel="shadowbox;width=800;height=600" title="your title"

Does this mean you have to make the links manually? Or maybe I'm completely misunderstanding...

I would like to use this function in a gallery where I would like to show additional information to the image and title (taken from the cck-fields in the node) to each image. I still want to be able to go to "next" and "prev" though, would I be isolating this particular node if I use iframe?

klucid’s picture

Thanks for the code, Yoda. Any chance you can post the php for Drupal 7? I tried the following, but it's not working. Thanks in advance!

EDIT: I've gotten it to work with the following code.


function THEMENAME_preprocess_page(&$vars) {
if (isset($_GET['pop']) && $_GET['pop']){
$vars['theme_hook_suggestion'] = 'page__popup';
}
}

rajmataj’s picture

I also managed to get this working but using the Context and Delta modules along with the Omega theme. Essentially, I created a new Delta configuration, disabled all the zones except for the one holding the Content region. I then used Context to trigger that Delta layout only to occur on the conditions of an anonymous user and on a certain node type. At least this way, the browser is not having to render all the regions that you don't want - but only the content. You can set the Shadowbox pop-up window to whatever dimensions are needed.

Display Suite also helped with the layout but that is a different story...

If anyone has another or a better solution for getting Shadowbox to load just a node's content area of a certain content type, please be sure to mention it here. Thanks.

franckdg’s picture

Version: 6.x-3.x-dev » 7.x-3.0-rc2
Component: Documentation » Code
Status: Closed (fixed) » Active

Hello,

I have the same problem with lightbox2 and Drupal 7 : when you suggest a template (as #9 did it), the html.tpl.php is always called and you have the entire data of the head and bottom in your frame, not only the one of the node.

I tried to place the code in the _preprocess_html hook but each time the PHP code of the template is not executed.

F

knalstaaf’s picture

I believe the module Colorbox node offers such a feature. But that module depends on the basic Colorbox module ofcourse, so you have to decide whether the switch would be worth it.