Check your version

This video covers a topic in Drupal 7 which may or may not be the version you're using. We're keeping this tutorial online as a courtesy to users of Drupal 7, but we consider it archived.

Dynamic templates with theme_hook_suggestions

Video loading...

Join Drupalize.Me to watch this video

Join today and gain instant access to our entire video library.

Log in Sign up
  • 0:02
    Dynamic templates with Theme Hook Suggestion
  • 0:06
    with Michelle Lauer
  • 0:08
    In this chapter, we are going to talk about creating
  • 0:11
    our own template suggestions.
  • 0:14
    By default, Drupal provides you with a couple optional ones.
  • 0:19
    So for our page content type, we could use the node.tpl.php
  • 0:27
    or we could also use node dash dash page.tpl.php.
  • 0:33
    So we're going to create another unique one.
  • 0:37
    So the first thing I want to do is go into our preprocess functions
  • 0:42
    for the node.

Dynamic Templates with theme_hook_suggestions


In this video we'll see how we can create our own template suggestions. We'll do this in our node preprocess function to create a new node template that will be used depending on the day of the week.

Additional resources: