开发者

Drupal - open node body in new window

So i got a problem and really haven't found any solution to this so i hope someone here can help me.

I got site with book navigation module. My front page has multiple blocks in it with each block containing book navigation and listing contents of different book.

The problem is that I need to open book pages from one block in a new window and this new window should only contain node's body data without template stuff surrounding it.

I've managed to open these node's in new window with custom module listing only book pages from given book but i can't 开发者_C百科figure out how to print only node body without template stuff in this new window.

My solution for opening book pages in new window is target="_blank" so it might not be the "drupal way" to do this so any tips for this would be appreciated, too.

Thanks a lot in advance!


in template.php (in your theme folder)

function THEMENAME_preprocess_page(&$vars) {   
  if (isset($_GET['popup']) && $_GET['popup'] == '1') {
    $vars['template_file'] = 'popup';
  } 
}

and create a popup.tpl.php inside your theme along with page.tpl.php ,with content

<?php echo $content ?>

refresh theme . now you can add ?popup=1 to any link you wanted . you will get only $content

for example 'user/1?popup=1' :)


If all you want is body text without any of the other "stuff", I recommend overriding the default theme for the content type you're using. You can either do it by hand (writing the PHP), or the Content Template (Contemplate) module might work.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜