Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
Is DS really needed?
Looking through some of TXP’s code, DS is used rather inconsistently. For example, txp_plugin.php uses forward slashes for all the includes. Given TXP’s been running on IIS servers, is DS really needed? It seems like as long as absolute paths are provided, PHP converts forward slashes to backslashes. Otherwise, the plugin tab wouldn’t be working for Windows-folk.
Offline
Re: Is DS really needed?
fwiw I didn’t use it, then was told it was a good idea so I switched, but I think that ended up causing problems on some local installs so I have reverted to using a plain old /
and letting PHP do the work. Rightly or wrongly.
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Txp Builders – finely-crafted code, design and Txp
Offline
Re: Is DS really needed?
For URLs the forward slash should be used, regardless of OS.
For file paths using DS is better in cases where there’s a risk of having paths with mixed forward/backslash like /programdata/textpattern\files. When slashes are used consistently (either forward slash or backslash, not both within one path), I don’t think DS is needed.
Offline
#4 2008-06-21 10:44:57
- net-carver
- Archived Plugin Author
- Registered: 2006-03-08
- Posts: 1,648
Re: Is DS really needed?
AFAIK you must use DS for all file path parsing.
Apart from the issue of code consistency; it doesn’t matter for strings you give the OS (like the ones JM mentioned in txp_plugin.php) the OS can cope with both.
However, it will matter when it comes to doing anything with a path the OS gives to you. Imagine you assume that a Unix (‘/’) directory delimiter is used. Then your code splits a path you get from your OS based on that assumption. That’s ok on Unix but your code fails to split the path as expected when it’s running on a windows server (‘\’) instead of Unix.
You then get support calls from the folks using your code/plugins — not fun — especially when you can’t reproduce the problem on your Unix box.
— Steve
Offline
Re: Is DS really needed?
Ahhh, makes sense. I’ll be more mindful of which direction the communication path is going when I do directory stuff in future, thanks for the advice.
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Txp Builders – finely-crafted code, design and Txp
Offline
Offline
Pages: 1