tags:

views:

33

answers:

1

Hey Guys

I cannot seem to figure out where to set the trusted_dir variable in Smarty 3. Now anytime I use a {insert name="func_name" script="thescript"} I get the error "missing script file".

Does anyone out there know how to allow this? $smarty->security is set to false.

Thank you.

EDIT: As of the posting of this question, this functionality has not been added to Smarty 3 yet, but a Smarty admin has assured me he will get onto adding the functionality ASAP. (http://www.smarty.net/forums/viewtopic.php?p=65549), so we should see it soon.

EDIT 2 The functionality has now been added to Smarty 3 and works as in Smarty 2! :-)

A: 

http://www.smarty.net/manual/en/variable.trusted.dir.php

It basically says that you have to enable security to access it.
To set the trusted_dir you would do something similiar to this:

$Smarty->trusted_dir = array(
     'my_first_dir',
     'my_second_dir/my_third_dir'
);

which would allow scripts from my_first_dir and my_third_dir (which is located within my_second_dir).

Chris
Thanks a million for the reply! This works perfectly in Smarty 2.x, as the documentation is all related to v2 at this stage, but unfortunately the base Smarty 3 class does not have this variable. :-(
Bjorn
Ah, I wasn't even aware of the fact that they have released a completely new Smarty version rewritten from scratch. My bet would be that, if it doesn't work, either they changed the variable name from `trusted_dir` to something like `trusted` or they just haven't gotten that far yet (if they're even planning on reinventing it).
Chris
Yeah, I was hoping for that too, but I've been up and down the list of class vars but there's nothing even remotely similar to 'trusted' ;-) If they haven't added it yet, they better hurry the **** up! :-)
Bjorn
Haha I suppose you just answered your own question. What you could do though, is to ask on their official forum if they are planning on renewing it or why they decided to remove it. http://www.smarty.net/forums/viewforum.php?f=29, please - keep us updated :)
Chris
Thanks Chris, I'll go and ask there. Will definitely post the solution here. Thanks again for all the help :-)
Bjorn