Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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
Comment #1
psynaptic CreditAttribution: psynaptic commentedDoesn't matter if they don't have the right extension. They just open as iframe.
Comment #3
BWPanda CreditAttribution: BWPanda commentedAre 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.
Comment #4
yoda-fr CreditAttribution: yoda-fr commentedhello,
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 !
Comment #5
psynaptic CreditAttribution: psynaptic commentedThat'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).
Comment #6
psynaptic CreditAttribution: psynaptic commentedComment #8
ssquirrel CreditAttribution: ssquirrel commentedin 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?
Comment #9
klucid CreditAttribution: klucid commentedThanks 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';
}
}
Comment #10
rajmataj CreditAttribution: rajmataj commentedI 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.
Comment #11
franckdg CreditAttribution: franckdg commentedHello,
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
Comment #12
knalstaaf CreditAttribution: knalstaaf commentedI 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.