Hey all...
On my site, I have no sidebars, its just one column. However, only on the blog part of the site, I want a sidebar. So, it makes sense that I created a page-blog.tpl.php file and added my sidebar in that.

Ok, that works great...sorta.

It displays exactly what I want on the /blog page. However, if you go directly to a blog post node, the sidebar isn't there (the page-blog.tpl.php file doesn't apply).

Is there a way to get this page-blog.tpl.php to apply to all my posts? (ideally, I would put the sidebar in the node-blog.tpl.php file, but you can't print a sidebar in there)

See the page with the sidebar at: http://www.mustardseedmedia.com/blog
See it not working on an individual post at: http://mustardseedmedia.com/blog/2007/mar/17/web_standards_are_good_for_...

Any help would be appreciated.

Thanks!

Comments

xano’s picture

Have you tried this?

Rob_Feature’s picture

Yes, Xano...this is exactly what I'm talking about.

I created a blog specific tpl.php file...however, it's not displaying that page for all my blog entries (when you view the full node). Looking for some help on why that is happening...

/**
  * Bob Christenson
  * Mustardseed Media
  * http://mustardseedmedia.com
  */
jvalletto’s picture

I think the problem you are having is a downfall found in Drupal with the templating system, and how it calls path based template files (ex. page-blog.tpl.php[ /blog/blah/blah/ ]).

The problem is the with the way drupal uses it's path system and clears the $_GET['q'] variable it needs to get the path based template files in PHPTemplate.

I have a patch you can use, assuming you are using APACHE, as I am unsure if it works on another system.

Add this line to the top of your template.php file. [Without the <? php ?> tags.]

$_GET['q'] = str_replace('q=', '', $_SERVER['QUERY_STRING']);

Let me know if this helps.

Jeremy

behestee’s picture

jvalletto, thank you very much, its works perfectly!

jared12’s picture

Another solution to the issue of a page-custom.tpl.php template not being applied to the the individual node pages can be found here. I just added the code from comment 1135771 to the template.php file in a Drupal 6.x installation, and it appears to do the trick.