Hi,

i wanted a page which displays only $content . successfully got the output when i used this code in template.php inside my theme.

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

and in popup.tpl.php , used
echo $content

now my question is , is there anyway to achieve same thing using a custom module?

Comments

jaypan’s picture

You can do the exact same thing in a module, but you would use MODULENAME instead of THEMENAME.

Contact me to contract me for D7 -> D10/11 migrations.

serjas’s picture

and i created popup.tpl in my module folder , refreshed theme and module , but not working

jaypan’s picture

Keep trying. You've got something linked wrong somewhere. Did you clear your cache? Check all paths? Ensure that your module is enabled? (don't answer these here, just use them to try to debug the problem yourself)

Contact me to contract me for D7 -> D10/11 migrations.

serjas’s picture

i think we cant use popup.tpl.php in module!

jaypan’s picture

If the file isn't in the root of your module folder, you will have to tell the system the path to the file.

Contact me to contract me for D7 -> D10/11 migrations.

serjas’s picture

its in root of folder .. normally popup.tpl.php wont work if there is no page.tpl.php if you use it in template.php , may be drupal wont permit us to do this type of operation in module?