You are not logged in.
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.
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.
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.
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.
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.