Hi,

I'm searching for a module (or a issue) to load the body of a page into a pop-up window.

A user have already ask this question in here, but there is no answear.

Does anyone have some ideas what is the best way or have any info on how to proceed?

Thanks in advance

mohamed

Comments

somes’s picture

have you tried using the load_node function inside a piece of pop up javascript

$node = node_load(array('nid' => $node->nid));
print $node>-body

not sure if that would work if not try calling a php file from with the javascript

haimoura’s picture

problem of connection

haimoura’s picture

Hi,
i'm back in this post with a solution.
the solution is here, it was posted by Vincent in drupalfr.org.
For non frensh speakers, i will try to explain how to to that:
-we must to add a variable to the link for the page that we want to load in the pop-up, example : http://mysite.com/node/18&pop=TRUE
-After , we must to add this portion of code in the template.php file in the theme folder:

function _phptemplate_variables($hook, $vars = array()) {
  if ($hook == 'page' && isset($_GET['pop']) && $_GET['pop']) {
    $vars['template_file'] = 'page-popup';
  }
  return $vars;
}

-After we must to duplicate the file page.tpl.php, the new file will have page-popup.tpl.php as a name, then we can customize the new template file as we want in order to delete header, footer...
that's all, and sorry for my English

mooffie’s picture

A simpler solution is to call-up your node via 'node/1234/popup'. Drupal would automatically use the template 'page-node-popup.tpl.php', if exists. No need to write a function.

http://drupal.org/node/104316

goose2000’s picture

Yeah, this is what I did, thanks. Now I can theme my popup, teach non-techies how to make a popup, and use the FCKEditor popup facilities in combination with this. Nice.

himagarwal’s picture

Why isn't this working in Drupal 7?

pwesthagen’s picture

Try page--node--popup.tpl.php

somes’s picture

What do you do with the $vars variable then where do you call it from to activate the pop up

PWG’s picture

I've implemented the changes as suggested above and I can change the layout of the target page but it does not open up in a popup window. Instead it insists on opening in the original window... By the way, where's the code that actually creates the popup?

(Boy, do I sound like the newbie I am *grin*)

Thanks,
/PWG

bengtan’s picture

You need to add the html attribute "target" = "_blank". The way to add this depends on what's rendering your link. If, for example, you are using l(), then you'd want something like ...

$output = l($text, $path, $popup ? array('target' => '_blank') : array());

Note: Please don't just copy and paste this because that won't work. You need to modify it to suit your circumstances.

PWG’s picture

Thanks!

Petter

bengtan’s picture

There are a variety of ways to open a new window. Using target="_blank" is just one of them. Most of the other techniques use javascript.

amitaibu’s picture