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 Quote Link to comment Share on other sites More sharing options...
MasterACE14 Posted July 10, 2008 Share Posted July 10, 2008 str_replace() , explode() maybe. ACE Quote Link to comment Share on other sites More sharing options...
maxudaskin Posted July 10, 2008 Author Share Posted July 10, 2008 I don't understand... ??? Quote Link to comment 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 />"; ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.