Hello,

I am trying to figure out how to do a lightbox type function to show a node. Really I want to have a mouseover, or click popup appear as a definition of content. I would like to be able to re-use the definition page and create as a node.

Is there an easy way to do this? I have tried using Lightbox2 and Thickbox and I can have the page appear but so does all of the drupal framing of the navigation etc. I only want the node to appear.

TIA

Comments

gollyg’s picture

This would become a little like an ahah request - returning a snippet of code rather than the whole page. There may be an easy way of doing it, but I would guess that you need to create (or find) a module that returns just that rendered html.

The basic process is probably not that hard - setup a module and hook a path, for example /ahah. When you generate the links create them as ahah/34 where the number following the slash is the node id. This will be the node id of the node you wish to view.

This path should pass off to a callback function that will automatically pick the parameter up. Sanity check it is an integer, and then attempt a node load on it. This should pass through standard access controls so it will be secure. Once you have the node object run it through node_view to get the html. Return this value.

To return the value you may need to set some custom headers etc to actually build the page and return it there and then exit() to stop the page build process. This shouldnt be too hard - have a look at a module that returns files such as csv to see how it is done.

Just a reminder to offer this functionality progressively - probably best to have standard links to normal node pages and then use javascript to convert them into the ahah representation.

good luck.