aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/smarty/smarty/docs/programmers/api-functions/api-set-template-dir.md
blob: 2de23309bf9879f361a4cad657bd4cf9e28b94b7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
setTemplateDir()

set the directories where templates are stored

Description
===========

Smarty

setTemplateDir

string\|array

template\_dir


    <?php

    // set a single directory where the templates are stored
    $smarty->setTemplateDir('./cache');

    // view the template dir chain
    var_dump($smarty->getTemplateDir());

    // set multiple directoríes where templates are stored
    $smarty->setTemplateDir(array(
        'one' => './templates',
        'two' => './templates_2',
        'three' => './templates_3',
    ));

    // view the template dir chain
    var_dump($smarty->getTemplateDir());

    // chaining of method calls
    $smarty->setTemplateDir('./templates')
           ->setCompileDir('./templates_c')
           ->setCacheDir('./cache');

    ?>

       

See also [`getTemplateDir()`](#api.get.template.dir),
[`addTemplateDir()`](#api.add.template.dir) and
[`$template_dir`](#variable.template.dir).