0

For example, {include 'path/to/template.tpl'}?

There's no mention in the documentation of said format, but it seems to work identically to:

{include file='path/to/template.tpl'}

Is this a quirk, or by design? I prefer the tidier syntax for when I'm not passing additional vars, but want to be sure it's an accepted format (ver. 3.0.7).

TheDeadMedic
  • 9,948
  • 2
  • 35
  • 50
  • 1
    I'm not sure if i understood you correct but both methods are correct / accepted. At the documentation, you can see the shorthand method in action too http://www.smarty.net/docs/en/language.function.include.tpl (section 7.53.) – sofl Jul 09 '12 at 12:09
  • @sofl Welp. That shows how attentive I am to documentation :s – TheDeadMedic Jul 09 '12 at 12:26

1 Answers1

1

{include "foo"}, {extend "foo"} etc. are shorthand notations (deliberately) introduced in Smarty3. It is safe to use them. There are a bunch of these, e.g. {foreach $foo as $bar} (compared to {foreach from=$foo item="bar"}). They don't differ performance-wise, so it really just boils down to your personal / team preference.

rodneyrehm
  • 13,442
  • 1
  • 40
  • 56