Need to create template file to be used on all of a certain Content Type.

2 replies [Last post]
philcoffaro
Offline
Last seen: 6 years 45 weeks ago
Joined: 2012-03-15

Hi All,

I’m relatively new to Drupal 7, but have watched all of the themeing videos here a time or two. What I need is to have a new layout template that will be used on all new content created for a certain content type, in my case (community pages).

These pages need to be to be generated without sidebar-first and sidebar-second for various reasons. I use the sidebars in other parts of the site, so I can’t just disable them.

So, how to I establish a template file that will be called to build the specific “content type” for my community pages? I checked the post here but didn’t see an answer. Thanks for the help. I love the videos by the way.

Here are some of my findings so far. Just need some help pulling it all together:
http://drupal.org/node/1089656 - Drupal Theme Hook Suggestions
http://drupal.org/node/1035656 - Drupal community post which seems to be an answer, although a little confusing for my current understanding of Drupal

Phil

Specs:
D7
Bartik theme
Bartik subtheme

philcoffaro
Offline
Last seen: 6 years 45 weeks ago
Joined: 2012-03-15
This appears to work, but...

The suggestions in this post appear to work, but I'm not sure that I added the processes function correctly.

Post: http://drupal.org/node/1035656

Here is what I did:

1) Created a template.php file for my subtheme.
2) Added only this code to my newly created subtheme/template.php file:

/* code starts */

function subtheme_process_page(&$variables) {
$variables['theme_hook_suggestions'][] = 'page__'. $variables['node']->type;
}

/* code ends */

Questions?:
1) Do I need to do anything else, or is this a solid way of doing this?
2) Do you see this causing any problems elsewhere?

Thanks!

philcoffaro
Offline
Last seen: 6 years 45 weeks ago
Joined: 2012-03-15
found a bug - still need help!

Something is still not quite right. Now I'm getting these two bug notices:

Notice: Undefined index: node in bartiksub_process_page() (line 7 of C:\Users\team\Documents\_sites\yo8\sites\all\themes\bartiksub\template.php).

Notice: Trying to get property of non-object in bartiksub_process_page() (line 7 of C:\Users\team\Documents\_sites\yo8\sites\all\themes\bartiksub\template.php).

Add to playlist

Add to , or

Add to new playlist:

Add to playlist
This is a member-only feature
But, it's easy to become a member

Add to cart:


Loading...
Contact us

Below are the supported keyboard shortcuts for our video player.

space
Start / stop video
shift
Go to next video
shift
Go to previous video
Increase or decrease player speed by 20%
Skip ahead or go back by 15 seconds
1...9
Jump to a percentage (2 is 20%, for example)
f
Toggle full screen
Videos Pricing More Search
BuildAModule Logo Icon BuildAModule Logo Icon
Become a member!
$29
1 month
$156
6 months
10% off
$276
12 months
20% off
All memberships come with the following:
24 / 7 access to the entire 1800+ video library
An innovative video player with a rolling transcript
Extensive Drupal and cross-platform training
A thorough and thoughtful training style
Progress tracking
Take notes on specific video sections
Intuitive multi-user management
How many users?
user
Go solo with a single user, or give multiple team members access through one account and get discounts by bundling multiple users into a single membership.