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,
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.
Comments
Comment #1
Anonymous (not verified) CreditAttribution: Anonymous commentedI 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?
Comment #2
ckuepker CreditAttribution: ckuepker commentedSubscribe.
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 1199function 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.Comment #3
yukare CreditAttribution: yukare commentedAs said in #2, it is broken, so change to bug report.
To be honest, until now i did look at this.
Comment #4
ckuepker CreditAttribution: ckuepker commentedOkay 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 :)
Comment #5
sorensong CreditAttribution: sorensong commented@ckuepker #4 worked perfectly!
Comment #6
yukare CreditAttribution: yukare commentedCan 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.
Comment #7
ckuepker CreditAttribution: ckuepker commentedWell there you have it:
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.
Comment #8
mariotux CreditAttribution: mariotux commented@ckuepker #4 worked perfectly!
Comment #9
sondes CreditAttribution: sondes commentedThe approach in #4 works great! Thanks! Remember to append "/lightbox2" to the end of node links. Otherwise, the custom template will not be used.
Comment #10
sreekanth1201 CreditAttribution: sreekanth1201 commentedWhere we need to append that "/lightbox2" . in view ..?
Comment #11
ckuepker CreditAttribution: ckuepker commentedIt 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.
Comment #12
laraz CreditAttribution: laraz commentedI have omega theme and this haven't got page.tpl.php... How can I do?
Anybody have this problem?
thanks.
-------------