[support] Overriding page.tpl.php for node type...

Steve Kessler skessler at denverdataman.com
Fri Apr 10 13:47:18 UTC 2009


You can make node TPL files. 

 

node-node_name.tpl.php

 

Is that what you are looking for?

 

-Steve

 

Steve Kessler 

Denver DataMan 

303-587-4428 

Sign <http://www.denverdataman.com/content/enewsletter-signup>  up for the
Denver DataMan Free eNewsletter

 

From: Scott Matthews [mailto:smatthews at optaros.com] 
Sent: Friday, April 10, 2009 7:41 AM
To: support at drupal.org
Subject: Re: [support] Overriding page.tpl.php for node type...

 

So you're saying there's no way, out of the box,  to have a page template
associate with a specific node type?

There's no function that I could write to automatically associate a page
template with a specific node type?

Is the only real way to achieve this with a view?

If this is true, that's helpful and I'll just go down that path.  I'm just
sure I know of people (who are on vacation now) that have made this work.

http://drupal.org/node/234279



On 4/10/09 9:33 AM, "Blake Hall" <hall.blake at gmail.com> wrote:

Basically, you should be calling the template file page-node-[url].tpl.php

Take a look at http://drupal.org/node/190815

The override priority for pages looks like this:

1.	page-node-edit.tpl.php 
2.	page-node-1.tpl.php 
3.	page-node.tpl.php 
4.	page.tpl.php

Cheers,

blake hall


On Fri, Apr 10, 2009 at 8:24 AM, Scott Matthews <smatthews at optaros.com>
wrote:

I'm not sure I understand your question?  I'm not using path auto or views.
I'm just typing in the URL:

http://localhost/type

And looking to access the page

Page-type.tpl.php



On 4/10/09 9:13 AM, "Steve Kessler" <skessler at denverdataman.com> wrote:

The page you are trying to create what is creating the URL. Does the URL
come from Pathautor or Views?
 
Thanks,
Steve
 

Steve Kessler 
Denver DataMan 
303-587-4428 
Sign up for the Denver DataMan Free eNewsletter
<http://www.denverdataman.com/content/enewsletter-signup>
<http://www.denverdataman.com/content/enewsletter-signup> 
 

From: Scott Matthews [mailto:smatthews at optaros.com]
<mailto:smatthews at optaros.com%5D> <mailto:smatthews at optaros.com%5D>  
Sent: Friday, April 10, 2009 6:53 AM
To: support at drupal.org
Subject: [support] Overriding page.tpl.php for node type...

This should be a simple question and answer...

I know that a basic premise of Drupals theme hierarchy should be that if I
want a page for a specific node I make a file page-[type].tpl.php.  I have
done this and I still get a "Page not found" issue.  Creating a
node-[type].tpl.php works for overriding the node template for the specific
node type.

Does anyone have any suggestions for what might be missing from the out of
the box Drupal solution to get this working?

I've tried adding the following function to my template.php which I found on
a forum post previously but with no success:

function _phptemplate_variables($hook, $vars) {
    if ($hook == 'page' && isset($vars['node'])) {
        $vars['template_files'][] = 'page-'.str_replace('_', '-',
$vars['node']->type);
    }
    return $vars;
} 


--
[ Drupal support list | http://lists.drupal.org/ ]



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.drupal.org/pipermail/support/attachments/20090410/c4538467/attachment.htm>


More information about the support mailing list