Custom resources for Smarty_Internal_Config (ConfigLoad) in Smarty 3?

81 views
Skip to first unread message

Joe Terranova

unread,
Jan 14, 2011, 3:50:31 PM1/14/11
to smarty-d...@googlegroups.com
In Smarty 2, one can use custom resources (ex: loading template bar via resource foo with foo:bar) for config_load config files. They were loaded as templates from the custom resource.

In Smarty 3, this doesn't appear to be the case. Smarty_Internal_Config is setup to grab only from the config directory. It splits off the foo part to config_resource_type, but doesn't use it for anything.

Would it be possible to get resource support added for config files?

Thanks,
Joe Terranova

globe

unread,
Jan 17, 2011, 11:33:12 AM1/17/11
to Smarty Developers
Hey Joe,

Config Files have been neglected somewhat.
Looks like I'll be rewriting this to work with the new Smarty_Resource
API for Smarty 3.1.

any other requests regarding the Config API while I'm at it?

Regards,
Rod

Joe Terranova

unread,
Jan 17, 2011, 12:03:13 PM1/17/11
to smarty-d...@googlegroups.com
No, I think that's it. Thanks!

Is there a timeline on 3.1? Our developer relied heavily on configs for our newest redesign, and only tested with 3 as an afterthought, so we'll unfortunately need to stay with 2 until this is added.

Thanks,
Joe Terranova

globe

unread,
Jan 17, 2011, 12:17:59 PM1/17/11
to Smarty Developers
Hey Joe,

On Jan 17, 6:03 pm, Joe Terranova <joeterran...@gmail.com> wrote:
> Is there a timeline on 3.1? Our developer relied heavily on configs for our
> newest redesign, and only tested with 3 as an afterthought, so we'll
> unfortunately need to stay with 2 until this is added.

We're hoping to release early February.

Regards,
Rod

MH

unread,
Jan 17, 2011, 6:49:31 PM1/17/11
to Smarty Developers

Hey globe,

This may be a topic for another thread, but when should devs start
testing against 3.1? Any significant b/c breaks to be aware of?

globe

unread,
Jan 18, 2011, 4:14:04 AM1/18/11
to Smarty Developers
Hi MH,

On Jan 18, 12:49 am, MH <spmhal...@gmail.com> wrote:
> This may be a topic for another thread, but when should devs start
> testing against 3.1?

we haven't even populated the Smarty 3.1 branch yet. All changes
reside in our own branches and need to be merged first. (Uwe has this
on his shorter list) Don't know when this will be ready, though.

> Any significant b/c breaks to be aware of?

I'm only aware of one minor change (to the currently undocumented
default_template_handler_func). Aside from that everything should be
fully BC.

Most changes were made to Smarty internals for performance or UTF-8
compatibility reasons. Externally they still behave like 3.0 did. The
Resource APIs have been rewritten completely. But with a focus of
adding functionality rather than changing it. Some things got
deprecated, but still work as expected.

Regards,
Rod

Martin B

unread,
Oct 22, 2011, 5:51:50 PM10/22/11
to smarty-d...@googlegroups.com
Am 17.01.2011 17:33, schrieb globe:
> Hey Joe,
>
> Config Files have been neglected somewhat.
> Looks like I'll be rewriting this to work with the new Smarty_Resource
> API for Smarty 3.1.
>
> any other requests regarding the Config API while I'm at it?
>
> Regards,
> Rod
>
>
Hello!
I recognized that this still has not changed, will the configLoad
function come back?

Regards,
Martin Beeger

globe

unread,
Oct 22, 2011, 6:03:52 PM10/22/11
to Smarty Developers
Hey There,

On Oct 22, 11:51 pm, Martin B <martin.bee...@online.de> wrote:
> I recognized that this still has not changed, will the configLoad
> function come back?

not sure what you mean. Smarty_Internal_Data::configLoad() exists
(inherited by Smarty).
It's documented here http://www.smarty.net/docs/en/api.config.load.tpl

Regards,
Rod

Martin B

unread,
Oct 22, 2011, 6:11:03 PM10/22/11
to smarty-d...@googlegroups.com
I always get the following error:

exception 'Exception' with message 'Undefined Smarty method "configload"' in /www/htdocs/w00c0515/goldiedb/data/smarty3/Smarty.class.php:530
Stack trace:
#0 [internal function]: Smarty->__call('configLoad', Array)
#1 /www/htdocs/w00c0515/tps/testfile.php(4): SmartyCustom->configLoad('mails.ini')
#2 {main}

mails.ini exists, i use Smarty 3.14 and i just inherited SmartyCustom from smarty.
Is this the wrong usage?

Regards,
Martin


globe

unread,
Oct 22, 2011, 7:37:12 PM10/22/11
to Smarty Developers
Hey There,

On Oct 23, 12:11 am, Martin B <martin.bee...@online.de> wrote:
> I always get the following error:
>
> exception 'Exception' with message 'Undefined Smarty method "configload"' in /www/htdocs/w00c0515/goldiedb/data/smarty3/Smarty.class.php:530

1) Line 530 of Smarty.class.php is a phpdoc comment:
http://code.google.com/p/smarty-php/source/browse/tags/Smarty_3_1_4/distribution/libs/Smarty.class.php#530

2) Smarty extends Smarty_Internal_Templatebase extends Smarty_Data.
Smarty_Data::loadConfig() is defined
http://code.google.com/p/smarty-php/source/browse/tags/Smarty_3_1_4/distribution/libs/sysplugins/smarty_internal_data.php#276

3) The tests in ConfigVarTests are all passing.


> #0 [internal function]: Smarty->__call('configLoad', Array)

If you're actually calling $smarty->__call('configLoad'); then yes,
this is WRONG.
$smarty->configLoad('filename'); should work

Regards,
Rod

Martin B

unread,
Oct 23, 2011, 5:48:02 AM10/23/11
to smarty-d...@googlegroups.com
Hey!
Some data has not been updated on my webserver so i partially still used
Smarty 3.0RC1 without having knowledge of it.
Was my mistake.
Thank you for your support.
Now all works fine.

Regards, Pizzard

Reply all
Reply to author
Forward
0 new messages