Dear all,

I've got one of those new-b Q's that should be obvious but it isn't to me....

I'm running a Drupal 6.14 site and it's themed with a custom theme.

I want to add a flash page without any of the menu systems / general template content, just 100% flash with a javascript loader in the HTML header. HTe page would be a pop-up page.

I also want the page to be 'secure' so users not logged in couldnt view it, so I'm thinking that I cant just use a HTML page and link to it.

How do I do this? Do I have to create a new template? If so do I also need to create a new node type? What would I call the node / template?

Sorry, I know this is probably a dumb Q but I cant get my head round it at the moment so thought I'd 'ask the community'.

Thank you ever so much

Chris

Comments

chrispeat’s picture

Further to yesterdays post:

I can create a custom template if i rename the .tpl file page-node-595.tpl.php BUT I need this to work for all node types... why doesnt it still work if i call the template page-node-pageflip.tpl.php?

(pageflip is the machine readable name that the content type is called, that I would like to create a custom template page for)

Any help on this would be very gratefully recieved, spent over a day renaming a file! arghhhhhhh!!!!

Thanks

Chris

chrispeat’s picture

I've found out part of the problem...

That I needed to flush the cache before the template would show up.

But I still have a problem in that if the template is called page-node-595.tpl.php it allows total control over the template, yet if I use page-node-pageflip.tpl.php or node-pageflip.tpl.php the template still appears to have a lot of inheritance from another template?

I just want a blank HTML page that I can load content into using the CMS and authenticate access? Is this the easiest way? How can I use the template for content type but not inherent another template?

Someone surely must be able to help here?

Thanks in advance!

Chris

Jeff Burnz’s picture

page-[content-type].tpl.php is not a default template suggestion for Drupal, so you will need to tell Drupal to use such a template.

You do this in the themename_preprocess_page function for you theme, set the conditions for which this template should be used and add it to the suggestions array.

Something like this:

function themeName_preprocess_page(&$vars, $hook) {

  global $theme;

  if ($vars['node']->type == 'pageflip') {
    $vars['template_files'][] = 'page-pageflip';
  }
}

Where your page template is called page-pageflip.tpl.php and as long as there is a page.tpl.php file in the same directory Drupal will pick it and use it whenever a node of the type "pageflip" is loaded.

node-pageflip.tpl.php is only going to theme the Node, not the whole page, so you'll need both and quite possibly, from what I can tell, your page template will need to look something like this:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php print $language->language ?>" lang="<?php print $language->language ?>" dir="<?php print $language->dir ?>">
<head>
  <title><?php print $head_title; ?></title>
  <?php print $head; ?>
  <?php print $styles; ?>
  <?php print $scripts; ?>
</head>      
<body>
  <?php print $content; ?>
  <?php print $closure; ?>
</body>
</html>
chrispeat’s picture

Thanks, this makes sense to me, I was really stuck with this as I'm new to drupal and havent got involved with the template side before. This help is ever so helpful, thanks again!

chrispeat’s picture

A slight issue has arose, when I do this, I loose my 'normal' edit screen, infact if I type 'node/X/edit' to access the edit screen my page isnt as id like... its the basic HTML that I wanted for my pure flash node.

How do I redirect edits to be the normal page?

Thanks again, this has been a life/time saver!

Chris :)