Display nodes with Lightbox2
Lightbox a powerful module in Drupal arena., proved its mastery once again! I was involved in trying to find a way to display nodes in popup, the apparent module that struck my way was Colorbox-Node. Things looked as if it would be a cake-walk but went beyond what I thought. The Colorbox-Node holds the ability to display nodes in overlay effect, but it needs huge template and jQuery level customization. All my assay went in vein, there came Lightbox to rescue.
No prelude to Lightbox is required to Drupal developers, but for newbie., It is a Module that can produce overlay/ popup effects to your site. Let me not deviate, the following steps were followed to Load a node in Lightbox.
1. Identify the template file using devel_themer or in case of Views use Advanced->Theme->information.
2. In my case I was using views to display the images associated with the nodes. On clicking the images It would show the full node in the Lightbox.
3. Add '/Lightbox' to the href and 'Lightframe' to the rel. It would look like
<a href= "node/<?php print $row->nid;?>/lightbox" rel="lightframe">
4. Save the Template file and clear the cache to see the node being loaded in Lightbox.
To extend further:
I had no need to display the sidebars, headers in the lightbox. Hence I wanted to remove these regions in the template files. Was a catch22 again because the Page-node.tpl.php was a common file. Any removal of regions will reflect in the full node view as well.
The thought to use a template based on content type struck as an idea. In my case only one content type was to be shown in lightbox, hence I moved further with my idea with no hesitation.
Place the below mentioned code in template.php in themes folder and create a template file called page--content-type.tpl.php, all nodes with that type will use the new template file.