How can I open popup window without the theme , but with node data

avior - February 26, 2008 - 21:07

Hi
I am using calendar module to display events (custom node type 'event') on month view
is it possible to open a popup window when the user clicks the day (or event) that doesn't have the theme but have the event data displayed ?

if i use node-event.tpl.php file i can only change the display of the event content.

Thanks
Avior

Perhaps try thickbox?

paulnem - February 26, 2008 - 21:59

Perhaps try thickbox?

Popups in Drupal 5

dario.godoy - March 30, 2008 - 05:10

First, I don't speak english very well. I will try you understand me.

Recently I found the way to display node data (or anything content) in a popup.

First Step.
You should have a menu item in a custom module with the path for show popups, for example:

$items[] = array(
    'path'  => 'popup/contact',
    'callback'=> 'custom_popup',
    'access'  => TRUE,
    'type' => MENU_CALLBACK,
    );

function custom_popup() {
return 'hello buddy';
}

If you enter now to popup/contact you can see "hello buddy" in a default theme, with the blocks and menus.

Second step.
Create a file in theme folder, page-popup.tpl.php
In this file you can delete menus regions, sidebar regions, help, mission, etc. Just leave $content and $message.
The template engine will use this file for all page contain "popup" in the url arguments, like "popups/event", "popups/event/1".

Then you can display custom popup.

l("popup", "popup/contact", array("target" => "_blank", "onclick" => "window.open(this.this, this.target, 'width=800,height=600'); return false;"));

In your case, you can create a custom path and load/view the node in the popup.

I hope you understand, and i hope this help you.

thanks dario, worked nicely

Quadbyte - April 7, 2008 - 05:59

thanks dario,
worked nicely for me, just had to change
window.open(this.this, this.target,
TO
window.open(this, this.target,

Need a bit more help

christophoffman - April 10, 2008 - 22:34

So I understand what you're doing here dario and thanks so much for putting this together. I guess I'm just a bit fuzzy on where these things should go. Could you provide the file name and locations for each piece of code?

Thanks again.

Popup Module

drarcon - April 23, 2008 - 14:24

Sry, but i´m a nub,
and my english isn´t well, too.

I do not understand the instructions at all, or only partially.

As the first step I have put on a .module and an .info file. I copy in

<?php $items[] = array(
   
'path'  => 'popup/contact',
   
'callback'=> 'custom_popup',
   
'access'  => TRUE,
   
'type' => MENU_CALLBACK,
    );

function
custom_popup() {
return
'hello buddy';
}
?>

I called it popup.module and popup.info and uploads it to /modules/popup
Then I have installed the module about module management.
Then i copy my page.tpl.php, deletes all and just leave
<?php print $messages ?>
          <?php print $content; ?>

and saved as page-popup.tpl.php
I have understood your explanation in such a way that it would already have to function with it. So I give a Menu Item the path to url popup/contact
But nothing happens.
I try a few diffrent links like your examples, but nothing happens.

Your operation :
Then you can display custom popup.

l("popup", "popup/contact", array("target" => "_blank", "onclick" => "window.open(this.this, this.target, 'width=800,height=600'); return false;"));

In your case, you can create a custom path and load/view the node in the popup.

i don´t understand completly. What should it be, Javascript? an replacement? What ist the l in front, a variable?
Plz help me somewhere and explane me exactlier, becouse I thing, thats is what I need.

Greets
Karsten

P.S.: I use Drupal 5.7

 
 

Drupal is a registered trademark of Dries Buytaert.