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 8051917
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T07:24:49+00:00 2026-06-05T07:24:49+00:00

Every time a tpl file is included the system first looks for a site-specific

  • 0

Every time a tpl file is included the system first looks for a site-specific version of the file and falls back to a standard one if the site specific one does not exist. So perahps I put include “customer/main/test1.tpl”. If our site is google, the system would first look for “customer/main/google_test1.tpl” and fall back to “customer/main/test1.tpl” if that file doesn’t exist.

Note: Smarty 2.6.x

  • 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-06-05T07:24:51+00:00Added an answer on June 5, 2026 at 7:24 am

    Did you know about the built-in template directory cascade? addTemplateDir and setTemplateDir allow you to specify multiple directories:

    $smarty->setTemplateDir(array(
      'google' => 'my-templates/google/',
      'default' => 'my-templates/default/',
    ));
    
    $smarty->display('foobar.tpl');
    

    Smarty will first try to find my-templates/google/foobar.tpl, if not found try my-templates/default/foobar.tpl. Using this, you can build a complete templating cascade.


    That won’t be too helpful if you have lots of elements on the same cascade-level. Say you had specific templates for google, yahoo and bing besides your default.tpl. A solution could involve the default template handler function. Whenever Smarty comes across a template it can’t find, this callback is executed as a measure of last resort. It allows you to specify a template file (or template resource) to use as a fallback.

    So you could {include}, {extend}, ->fetch(), ->display() site_google.tpl. If the file exists, everything is fine. If it doesn’t, your callback could replace _google with _default to fallback to the default template.


    If neither template_dir cascade nor default template handler function seems applicable, you’ll want to dig into custom template resources.

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

Sidebar

Related Questions

Every time I start a project with some graphical toolkit, one of the first
Every time I try to post to twitter in my rails app, the first
Every time I commit with bazaar, it contacts my remote repository (the one I
Every time in PHP when I make a variable such as this one: $date
Every time a database diagram gets looked out, one area people are critical of
Every time I double click a file it opens it in a new window.
Every time I change a file in a web project in Visual Studio (.js,
Every time I access data in $_SESSION, Does it immediately update the session file
Every time I create a controller, rails generate a controler_name.js and a controller_name.css file
Every time when I run my test first step is log in and than

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.