I've used lightbox2 in a D6 Project and it works fine.

In D7 however the template file is not recognized. What to do? I copied the tpl file into my theme folder (I'm using 'Basic'), flushed the cache and refreshed. The links are formatted like this: href="node/538/lightbox2" rel="lightframe". The lightbox opens, but only in standard layout, e.g. with all navigation and sidebars.


I think the problem can be broken down into 2 questions:

1) Shouldn't the template be "page--node--lightbox2.tpl.php" instead of "page-node-lightbox2.tpl.php"?
2) How can I make sure that the template is called at all? Should I add something to the template.php?


I have the same problem that Lightbox2 displays nodes with all standard blocks (menus, ..) around it when linked via href="node/123/lightbox2" like described in the documentation [for D5 and 6]. Is this a bug inside the module 7.x-dev or is it me, not doing it right? Didn't try out that - or -- template file naming stuff. Will try that tomorrow but I hope for further assistance here.

Edit: Tried renaming of the above mentioned template file to -- name but file seems to be used never. I then looked into the module code of lightbox2.module and probably found the responsible lines of code starting from line 1199 function lightbox2_preprocess_page(..). Looks like its trying to remove all regions, except the one called 'content'. Through simple debugging I found out, that the index 'content' isn't defined here (at least using default D7 theme). Nevertheless the regions don't get removed although this function definitely is called when trying to view a node in lightbox. I know nearly nothing about hooks and preprocessing therefore I don't know what could be done to fix this. Hoping for further investigation by the maintainers.

Component:Documentation» Code
Category:support» bug

As said in #2, it is broken, so change to bug report.
To be honest, until now i did look at this.

Okay I found something that made it work for me. I tried with the page-node-lightbox2.tpl.php from modules directory again. Copied it to my theme folder and renamed it to -- instead of -. What I saw then, was a white screen (no content loaded at all but head and body are being created as they should) inside my Lightbox. Thats better than nothing but not what I needed.

So I tried around a bit. Copied the page.tpl.php from my theme and renamed it to page--node--lightbox2.tpl.php. That actually did the trick. By removing line after line of unwanted output I finally achieved the simple node content. Only disturbing thing is the remaining Administration Menu. But at least, I'll be the only one that sees it.

Since my last comment I switched from standard theme to Zen but I think it should work with any theme.

Nevertheless the bug remains as the mentioned function in lightbox2.module should do all the work for me :)

@ckuepker #4 worked perfectly!

Can you post the template here? I can look on removing the admin menu if is necessary and use it as the default template in lightbox.

Well there you have it:

  <div id="main-wrapper"><div id="main" class="clearfix">
    <div id="content" class="column"><div class="section">
      <a id="main-content"></a>
      <?php print render($title_prefix); ?>
      <?php if ($title): ?>
        <h1 class="title" id="page-title"><?php print $title; ?></h1>
      <?php endif; ?>
      <?php print render($title_suffix); ?>
      <?php print $messages; ?>
      <?php if ($tabs = render($tabs)): ?>
        <div class="tabs"><?php //print $tabs; ?></div>
      <?php endif; ?>
      <?php print render($page['help']); ?>
      <?php if ($action_links): ?>
        <ul class="action-links"><?php print render($action_links); ?></ul>
      <?php endif; ?>
      <?php print render($page['content']); ?>
      <?php print $feed_icons; ?>
    </div></div><!-- /.section, /#content -->
  </div></div><!-- /#main, /#main-wrapper -->

But remember that this one is from Zen.

Edit: I think the admin menu (the module which replaces the toolbar on top of the page) is inserted via JavaScript so it might not be that easily removed on a single path. At least I don't know how I could do that.

@ckuepker #4 worked perfectly!

The approach in #4 works great! Thanks! Remember to append "/lightbox2" to the end of node links. Otherwise, the custom template will not be used.

Where we need to append that "/lightbox2" . in view ..?

It must be appended to the links href-attribute that should open the content in a lightbox. In views you can do that by using field display and then rewriting the output of the field that creates the link. Should be possible by using the views UI.

I have omega theme and this haven't got page.tpl.php... How can I do?

Anybody have this problem?



I find a solution: I install context and delta modules. With this I can create a template for any page, view, ....
I hope someone will serve the answer.