Header in lightbox2 node display


Author Message
Peter S

Posted: 10/19/2010
Quote message 

On my site I use Lightbox2 to display pages (Drupal nodes). In this lightbox, I prefer that the header is not shown. In the standard Drupal theme this is the case: lightbox only shows the page content.

I'm working on a new theme with Artisteer, and I notice that the page header (site logo and graphic) as well as the footer (contact information, syndication, ...) are printed as well.

How can I drop this? I'm afraid that if I start changing in the code (which I'm not very familiar with!) I drop these parts on all pages.
(Content type = page - so only when this page is shown in Lightbox, the header and footer should be dropped)

Thanks,
Peter
 
Lawrence

Posted: 10/19/2010
Quote message 

To kick things off, which Lightbox are you using? Are you using Lightbox module, Imagecache lightboxes, etc,. There're several modules applying them in their own way.

Also, what exactly do you mean the header / logo are printed? Do you mean when you click the logo / footer / header, they're expanded up into a lightbox? This isn't normal behavior, perhaps a misconfiguration of lightboxes. If not, provide more details or a link so we can check it out. :-)
 
Peter S

Posted: 10/19/2010
Quote message 

Thanks for the very fast reply.

If you surf now to www.aeroquiz.net - which is still in the old, standard, theme as of October 19th 2010 - you see that I ask aviation related quiz questions. The answer is opened in a lightbox - neatly only the node content without ballast. So this, in my humble newbee opinion, excludes lightbox misconfigurations.

As mentioned, when opening the same page with the Artisteer theme, there is also the Artisteer Header and Footer displayd.

I use the lightbox2 module (http://drupal.org/project/lightbox2)
 
Peter S

Posted: 10/19/2010
Quote message 

In the meantime I put the new theme online... that way you can better see what I mean.
 
Lawrence

Posted: 10/22/2010
Quote message 

I see what you mean. I'm not sure what's causing the header, footer, and other areas of the theme to show in the lightbox. Have you considered making a node template for your answers to print only the node body?

I'll see if I can make some time to try this out with an Artisteer theme and Drupal's default core theme. In the meantime, see if you can make a node template that only prints the node body.

Making a node template is easy. Copy node.tpl.php and name it "node-story.tpl.php" and remove any of the displays you don't want from the new file. Replace "Story" with the machine name of your content type.
 
Peter S

Posted: 10/23/2010
Quote message 

Ok, I'll try that, but it's quite cumbersome as I will need to duplicate each page into one node in the normal lay-out, and another node in this content type for display through Lightbox.

In any case: I appreciate your suggestion a lot!

Thanks
 
Peter S

Posted: 10/23/2010
Quote message 

.. another issue is also that the node is displayed in a width of this original theme whereas I want to make the lightbox a little narrower...

Would it maybe possible to use a different theme to display the nodes in Lightbox?
 
Peter S

Posted: 10/23/2010
Quote message 

I checked the Drupal form for some 'inspiration'. On there the following is put: (link http://drupal.org/node/252260)

Quote :
Drupal 5.x users will need to copy the lightbox2/page-node-lightbox2.tpl.php file to their theme's own directory and ensure it is readable. This file can be modified to suit your theme. This is not a requirement for Drupal 6.x users, but the file is provided in case you need to override the default layout.


I did this, but it froze up IE 8, and Firefox told me there is an error in 'Line 18' of the above mentioned file.



 
Lawrence

Posted: 10/23/2010
Quote message 

You know what, I'm thinking you could possibly just print the node body.

<?php
print $node->content['body']['#value'];
?>

If you can find a way to work that into Lightbox, maybe that'd be the solution? Hope this helps. If not, let me know and I'll try to find another solution. If anything, you could always just use images to print the answer.

I've noticed the answer is already an entirely separate node, node/98. What I'm thinking is since it's an iframe lightbox is using, your drupal site's picking up a whole page load and is still trying to pass the template variables to the browser. This would still result in the styles being displayed. That's why I think a node template would be best with just the node body and perhaps title, along with a content type just for those nodes.
 
Peter S

Posted: 10/25/2010
Quote message 

Made the changes, and it works
 
Peter S

Posted: 10/25/2010
Quote message 

Thanks Lawrence,

My complete page-node-lightbox2.tpl.php looks now like this:

Quote :
<?php
// $Id: page-node-lightbox2.tpl.php,v 1.1.2.2 2008/06/11 22:16:38 snpower Exp $

/**
* @file
* Template file for displaying the node content, associated with an image, in
* the lightbox. It displays it without any sidebars, etc.
*/
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php print $language->language ?>" lang="<?php print $language->language ?>" dir="<?php print $language->dir ?>">
<head>
<title><?php print $head_title ?></title>
<?php print $head ?>
<?php print $styles ?>
<?php print $scripts ?>

</head>
<body>
<?php
print $node->content['body']['#value'];
?>



I just want to add the node title on the top of the page, but that will be for another lunch break ;-)


 
Lawrence

Posted: 10/25/2010
Quote message 

Great! You're welcome, and glad you're making progress. :-)

Adding the title is easy. Place this - <?php print $title ?> where you need it to go. Alternatively, you could leave the title out altogether for an answer only approach, but that's entirely up to your preference.