$tpl-display('path/to/template') breaks in function

137 views
Skip to first unread message

Martin Mikson

unread,
Jan 22, 2014, 1:57:07 PM1/22/14
to phps...@googlegroups.com
Hello,

I want to make function to display an error template, but without success.

Here's the code, i want to make it:

function inline_errors($errors, $title="") {

    global $tpl;

    if(!is_array($errors)) {
        $errors = array($errors);
    }

    if(empty($title)) {
        $title = "Please correct the following errors!";
    }

    $errorlist = $errors;

    $tpl->error_title = $title;
    $tpl->errorlist = $errorlist;

    $tpl->display('templates/errors/inline_errors.tpl.php');
}

Is there something wrong, or i cannot use $tpls->display in functions?

Best regards.

Trey Ellis

unread,
Jan 8, 2015, 12:54:59 PM1/8/15
to phps...@googlegroups.com
What is the error you are receiving? By experience I've noted that Savant uses the top level directory on you're server. So for instance the path to you're tpl.php ahould be templates/errors/inline_errors.tpl.php.
Reply all
Reply to author
Forward
0 new messages