View previous topic :: View next topic |
Is $smarty->default_resource_type needed? |
Yes, it's useful. |
|
66% |
[ 4 ] |
No, it's unnecessary. |
|
33% |
[ 2 ] |
|
Total Votes : 6 |
|
Author |
Message |
messju Administrator
Joined: 16 Apr 2003 Posts: 3336 Location: Oldenburg, Germany
|
Posted: Sat Apr 19, 2003 11:13 am Post subject: $smarty->default_resource_type |
|
|
i want to try out this poll-feature of phpBB and there has been discussion if one needs to be able to change the default resource-type from "file:" to something different ("tpltree:" to look for templates in a search_path was an example).
so here is my question.
(disclaimer: it's also a little test, i don't guarantee that Smarty will reflect the results of the poll anytime soon. ) |
|
Back to top |
|
rosier Smarty n00b
Joined: 20 Apr 2003 Posts: 2 Location: NL
|
Posted: Sun Apr 20, 2003 3:12 pm Post subject: |
|
|
If you going to change something on the resource-types I would suggest to also change the resource-type names to an more url like name. Changing 'file:' to 'file://' can keep Smarty (on windows) from mistaking an driveletter for an resource |
|
Back to top |
|
Tom Sommer Administrator
Joined: 16 Apr 2003 Posts: 47 Location: Denmark
|
Posted: Sun Apr 20, 2003 4:50 pm Post subject: |
|
|
rosier wrote: | If you going to change something on the resource-types I would suggest to also change the resource-type names to an more url like name. Changing 'file:' to 'file://' can keep Smarty (on windows) from mistaking an driveletter for an resource | Good idea...!! |
|
Back to top |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Sun Apr 20, 2003 7:00 pm Post subject: |
|
|
That is a nice idea, but does introduce a compatability issue. |
|
Back to top |
|
boots Administrator
Joined: 16 Apr 2003 Posts: 5611 Location: Toronto, Canada
|
Posted: Tue Apr 22, 2003 5:43 am Post subject: |
|
|
mohrt wrote: | That is a nice idea, but does introduce a compatability issue. |
Yeah, but at the least, smarty should have a policy to not allow single letter resource types just so that windows paths can be supported properly. My guess is that BC is not very relevant as there are likely very few 1 letter resource types already written
As you know, without this, explicit paths on windows require file: to be specified meaning that there is no "default" type on that platform for explicit paths. |
|
Back to top |
|
boots Administrator
Joined: 16 Apr 2003 Posts: 5611 Location: Toronto, Canada
|
Posted: Fri Jun 06, 2003 1:14 pm Post subject: |
|
|
Any chance this feature will make it to the core? |
|
Back to top |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Fri Jun 06, 2003 1:22 pm Post subject: |
|
|
The "correct" way to fix this would be to change file: to file://, but that is the backward compatability problem I was referring to. The only other way to work around the problem is to ignore one-character resource types, which should be fairly safe... but does that cover the problem? Is it possible to have two-character drive mappings in windows? |
|
Back to top |
|
boots Administrator
Joined: 16 Apr 2003 Posts: 5611 Location: Toronto, Canada
|
Posted: Fri Jun 06, 2003 3:21 pm Post subject: |
|
|
mohrt wrote: | The "correct" way to fix this would be to change file: to file://, but that is the backward compatability problem I was referring to. |
Can you please remind me: where is the BC issue? The way I read it, the feature request is for a default_resource_type meaning that Smarty loads templates either from the resource type specified in the file parameter or from the resource type specified in default_resource type. I propose that a blank default_resource_type defaults to the logic currently in Smarty. I think the BC is only introduced with the "//" syntax.
mohrt wrote: | Is it possible to have two-character drive mappings in windows? |
Not AFAIK though I'm nearly positive that it is limited to 1 char. |
|
Back to top |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Fri Jun 06, 2003 3:50 pm Post subject: |
|
|
OK, default_resource_type var added, 1 char resource names ignored. Committed to CVS.
Monte |
|
Back to top |
|
boots Administrator
Joined: 16 Apr 2003 Posts: 5611 Location: Toronto, Canada
|
Posted: Fri Jun 06, 2003 5:05 pm Post subject: |
|
|
mohrt wrote: | OK, default_resource_type var added, 1 char resource names ignored. Committed to CVS.
Monte |
very cool, can't wait to try it out. Thanks, Monte! |
|
Back to top |
|
boots Administrator
Joined: 16 Apr 2003 Posts: 5611 Location: Toronto, Canada
|
Posted: Fri Jun 06, 2003 8:18 pm Post subject: |
|
|
Concerning template loading, it would be 'nice' if there was a default template extension (which for BC would default to '') to go along with the default resource type.
For example, depending on my resource, I may or may not want to use file extensions. Of course, the filesystem (at least windows) expects an extension, so there I use TEMPLATE.tpl. But when I port the template to my db, I want to simply use TEMPLATE without an extension of any kind.
By having both default resource types and default template types, I can simply write file="TEMPLATE" and always get the correct result. Otherwise I would have to update my template references when I switch resource types.
In other words, I want resource types to be able to control the type of extension they use. Unfortunately, since "file" is builtin (and can not be altered) the only convenient way I can see to do this would be to add a new default setting.
@Monte: I sent you a bug report and patch for the CVS update you did for default_resource_type.
UPDATE June 10: I have created a patch that provides this feature via a resource map for extensions. Works well for me. If anyone is interested, let me know. |
|
Back to top |
|
|