Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

$smarty->default_resource_type

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Feature Requests
View previous topic :: View next topic  

Is $smarty->default_resource_type needed?
Yes, it's useful.
66%
 66%  [ 4 ]
No, it's unnecessary.
33%
 33%  [ 2 ]
Total Votes : 6

Author Message
messju
Administrator


Joined: 16 Apr 2003
Posts: 3336
Location: Oldenburg, Germany

PostPosted: Sat Apr 19, 2003 11:13 am    Post subject: $smarty->default_resource_type Reply with quote

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. Smile )
Back to top
View user's profile Send private message Send e-mail Visit poster's website
rosier
Smarty n00b


Joined: 20 Apr 2003
Posts: 2
Location: NL

PostPosted: Sun Apr 20, 2003 3:12 pm    Post subject: Reply with quote

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
View user's profile Send private message
Tom Sommer
Administrator


Joined: 16 Apr 2003
Posts: 47
Location: Denmark

PostPosted: Sun Apr 20, 2003 4:50 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger MSN Messenger
mohrt
Administrator


Joined: 16 Apr 2003
Posts: 7368
Location: Lincoln Nebraska, USA

PostPosted: Sun Apr 20, 2003 7:00 pm    Post subject: Reply with quote

That is a nice idea, but does introduce a compatability issue.
Back to top
View user's profile Send private message Visit poster's website
boots
Administrator


Joined: 16 Apr 2003
Posts: 5611
Location: Toronto, Canada

PostPosted: Tue Apr 22, 2003 5:43 am    Post subject: Reply with quote

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 Smile

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
View user's profile Send private message
boots
Administrator


Joined: 16 Apr 2003
Posts: 5611
Location: Toronto, Canada

PostPosted: Fri Jun 06, 2003 1:14 pm    Post subject: Reply with quote

Any chance this feature will make it to the core?
Back to top
View user's profile Send private message
mohrt
Administrator


Joined: 16 Apr 2003
Posts: 7368
Location: Lincoln Nebraska, USA

PostPosted: Fri Jun 06, 2003 1:22 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
boots
Administrator


Joined: 16 Apr 2003
Posts: 5611
Location: Toronto, Canada

PostPosted: Fri Jun 06, 2003 3:21 pm    Post subject: Reply with quote

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
View user's profile Send private message
mohrt
Administrator


Joined: 16 Apr 2003
Posts: 7368
Location: Lincoln Nebraska, USA

PostPosted: Fri Jun 06, 2003 3:50 pm    Post subject: Reply with quote

OK, default_resource_type var added, 1 char resource names ignored. Committed to CVS.

Monte
Back to top
View user's profile Send private message Visit poster's website
boots
Administrator


Joined: 16 Apr 2003
Posts: 5611
Location: Toronto, Canada

PostPosted: Fri Jun 06, 2003 5:05 pm    Post subject: Reply with quote

mohrt wrote:
OK, default_resource_type var added, 1 char resource names ignored. Committed to CVS.
Monte


Very Happy very cool, can't wait to try it out. Thanks, Monte!
Back to top
View user's profile Send private message
boots
Administrator


Joined: 16 Apr 2003
Posts: 5611
Location: Toronto, Canada

PostPosted: Fri Jun 06, 2003 8:18 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Feature Requests All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP