maxudaskin Posted July 10, 2008 Share Posted July 10, 2008 I take a one week break from PHP and look what happens. <?php include("./constants.php"); $stylesheet; // Set Variable for Later Use if(!file_exists("styles/style.txt")){ echo "<strong>An Error Has Occured: Cascading Style Sheet Setup File is Corrupt or missing. Reverting to default style.</strong>"; // Output Warning $stylesheet = ROOTURL . "include/styles/default/default.css"; // Set Style Sheet as Default }else{ $style_text = preg_split("/\-\-\-/",implode('',file("styles/style.txt"))); // Get file contents and Split it up $folder = trim($style_text[1]); // Set the folder name $file = trim($style_text[3]); // Set the file name echo ROOTURL . "include/styles/" . $style_text[1] . "/" . $style_text[3] . ".css<br /><br />"; if(file_exists(ROOTURL . "include/styles/" . $folder . "/" . $file . ".css")){ // If the specified file exists $stylesheet = ROOTURL . "include/styles/" . $folder . "/" . $file . ".css"; // Set Style Sheet as Specified }else{ if($secondary == "default"){ $stylesheet = ROOTURL . "include/styles/default/default.css"; // Set Style Sheet as Default }else{ $folder = trim($style_text[5]); // Set the folder name $file = trim($style_text[7]); // Set the file name if(file_exists(ROOTURL . "include/styles/" . $folder . "/" . $file . ".css")){ $stylesheet = ROOTURL . "include/styles/" . $folder . "/" . $file . ".css"; // Set Style Sheet as Specified }else{ $stylesheet = ROOTURL . "include/styles/default/default.css"; // Set Style Sheet as Default } } } } ?> Style.txt This file was written by Max Udaskin. Please refer to the users manual before attempting to edit this file. Standard Folder Name --- standard --- File Name --- red --- =============== Secondary Folder Name --- standard --- File Name --- white --- Output http://www.virtualzoom.net/pirepdemo/include/styles/ standard / red .css Note the spaces. What I want it to do is: http://www.virtualzoom.net/pirepdemo/include/styles/standard/red.css Link to comment https://forums.phpfreaks.com/topic/114014-solved-spaces-in-an-array/ Share on other sites More sharing options...
MasterACE14 Posted July 10, 2008 Share Posted July 10, 2008 str_replace() , explode() maybe. ACE Link to comment https://forums.phpfreaks.com/topic/114014-solved-spaces-in-an-array/#findComment-585987 Share on other sites More sharing options...
maxudaskin Posted July 10, 2008 Author Share Posted July 10, 2008 I don't understand... ??? Link to comment https://forums.phpfreaks.com/topic/114014-solved-spaces-in-an-array/#findComment-585991 Share on other sites More sharing options...
rlindauer Posted July 10, 2008 Share Posted July 10, 2008 You have set these variables ($folder, $file) and trimmed them, but do not use them. <?php $folder = trim($style_text[1]); // Set the folder name $file = trim($style_text[3]); // Set the file name echo ROOTURL . "include/styles/" . $style_text[1] . "/" . $style_text[3] . ".css<br /><br />"; ?> Link to comment https://forums.phpfreaks.com/topic/114014-solved-spaces-in-an-array/#findComment-586018 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.