Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3612882
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T22:03:20+00:00 2026-05-18T22:03:20+00:00

When extending with doLayout you can only have one sub-template, but you can include

  • 0

When extending with doLayout you can only have one sub-template, but you can include more than one.

What is the difference, and what is the best practice?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T22:03:21+00:00Added an answer on May 18, 2026 at 10:03 pm

    They are kind of inverse of each other.

    doLayout is used as part of the extends tag. The extends tag specifies which template you wish to extend, and the doLayout tag specifies where in the extended template your code is injected.

    The include tag simply specifies that another template should be injected at the point specified.

    So, doLayout works in a similar way to include, except the doLayout tag does not specify which template is being injected. This is done by the extends tag, and means that the template (which usually contains headers, footers and common css and javascript), can be extended without it needing to know anything about the template that is extending it.

    Include, is just a dumb injection of code.

    If you wanted to achieve the doLayout functionality with includes (and this is the way you would do it in PHP or something similar), you could do

    #{include 'header.html'}
    your template code
    #{include 'footer.html'}
    

    This would have to be replicated on every page in your template. Whereas using extends and doLayout allows you to simply do

    #{extends 'template.html'}
    

    And where your code is injected into the template.html is managed by the doLayout tag.

    The extends approach is simply a neater way. Also, if you decide to change the layout of your page, you only need to update one file, and gives your more flexibility with where you content is located inside your extended template.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am having trouble extending one of my styles that I have defined in
I am extending a template class using C++ in Visual Studio 2005. It is
I am extending my Object Property Value Diff but I realized if an object
I have implemented a SAX parser in Java by extending the default handler. The
I am extending the WPF Calendar control, and I have copied the control templates
I have a Class extending JFrame that is watching for a mouse click anywhere:
When extending AbstractProcessor , there is a possibility to override init(...) , but there
i'm extending UITableViewController and have a uibutton added programtticly to the table footer ,
When extending classes, I find it very descriptive to use the base ( MyBase
I'm new to extending Drupal, though I've done similar kinds of things for other

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.