[Phplib-trackers] [ phplib-Bugs-820062 ] template.inc and Windows
Brought to you by:
nhruby,
richardarcher
From: SourceForge.net <no...@so...> - 2004-04-21 07:44:01
|
Bugs item #820062, was opened at 2003-10-09 02:06 Message generated for change (Comment added) made by richardarcher You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=403611&aid=820062&group_id=31885 Category: Template Group: None Status: Open >Resolution: Duplicate Priority: 5 Submitted By: Sven Eichler (koala_s) >Assigned to: Richard Archer (richardarcher) Summary: template.inc and Windows Initial Comment: When you use template.inc with windows, it give a problem in function "filename($filename)" when isset var $root = "."; My solution: function filename($filename) { if ($this->debug & 4) { echo "<p><b>filename:</b> filename = $filename</p>\n"; } if (substr(PHP_OS, 0, 3) != 'WIN') { if (substr($filename, 0, 1) != "/") { $filename = $this->root."/".$filename; } } if (!file_exists($filename)) { $this->halt("filename: file $filename does not exist."); } return $filename; } But I not sure work this with all OS and is it a good way. ---------------------------------------------------------------------- >Comment By: Richard Archer (richardarcher) Date: 2004-04-21 17:44 Message: Logged In: YES user_id=279311 Fixed in CVS ---------------------------------------------------------------------- Comment By: Joe Stewart (joestewart) Date: 2004-03-31 00:50 Message: Logged In: YES user_id=77269 There has also been a patch posted for quite awhile here: https://sourceforge.net/tracker/index.php?func=detail&aid=682841&group_id=31885&atid=403613 ---------------------------------------------------------------------- Comment By: Nobody/Anonymous (nobody) Date: 2004-03-30 22:30 Message: Logged In: NO There is only a problem if you use an absolute filepath, for example 'c:\temlates\test.thtml', '\template\test.thtml' or 'c:/templates\test.thtml'. (all are valid for windows-php) My solution: function filename($filename) { if ($this->debug & 4) { echo "<p><b>filename:</b> filename = $filename</p>\n"; } if (substr($filename, 0, 1) != "/" && substr($filename, 0, 1) != "\" && substr($filename, 1, 2) != ":\" && substr($filename, 1, 2) != ":/" ) { $filename = $this->root."/".$filename; } if (!file_exists($filename)) { $this->halt("filename: file $filename does not exist."); } return $filename; } ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=403611&aid=820062&group_id=31885 |