DontCare 1 Posted February 28, 2015 Share Posted February 28, 2015 Hi friends. I have a little problem about my homepage that have got pages folder but I want to create a wiki folder. I don't know how can I create a folder but my index.php is ; <?php $includeDir = ".".DIRECTORY_SEPARATOR."pages".DIRECTORY_SEPARATOR; $includeDefault = $includeDir."home.php"; if(isset($_GET['s']) && !empty($_GET['s'])) { $_GET['s'] = str_replace("0", '', $_GET['s']); $includeFile = basename(realpath($includeDir.$_GET['s'].".php")); $includePath = $includeDir.$includeFile; if(!empty($includeFile) && file_exists($includePath)) { include($includePath); } else { include($includeDefault); } } else { include($includeDefault); } ?> Link to comment Share on other sites More sharing options...
DontCare 1 Posted February 28, 2015 Author Share Posted February 28, 2015 Help me please Link to comment Share on other sites More sharing options...
DontCare 1 Posted March 1, 2015 Author Share Posted March 1, 2015 Help Link to comment Share on other sites More sharing options...
DontCare 1 Posted March 6, 2015 Author Share Posted March 6, 2015 Push Link to comment Share on other sites More sharing options...
DontCare 1 Posted March 6, 2015 Author Share Posted March 6, 2015 Bump Link to comment Share on other sites More sharing options...
DontCare 1 Posted March 6, 2015 Author Share Posted March 6, 2015 Help Link to comment Share on other sites More sharing options...
Aurora 46 Posted March 6, 2015 Share Posted March 6, 2015 I dont understand the problem? Link to comment Share on other sites More sharing options...
DontCare 1 Posted March 7, 2015 Author Share Posted March 7, 2015 I dont understand the problem? My problems is I have a only "pages" folder, but I want to create a "wiki" folder and change the adress. For instance, from ?s=example to ?w=wikipages. Link to comment Share on other sites More sharing options...
owaran 120 Posted March 7, 2015 Share Posted March 7, 2015 i will help you ..الذي ولد ليكون أرماديلو، يموت حفر Link to comment Share on other sites More sharing options...
Aurora 46 Posted March 7, 2015 Share Posted March 7, 2015 <a href="wiki/index.php">Wiki</a> you mean this? make a wiki folder and put the files there? Link to comment Share on other sites More sharing options...
Solution owaran 120 Posted March 7, 2015 Solution Share Posted March 7, 2015 if (!(empty($_GET['s'])) || empty($_GET['w'])) { $p_name = "pages"; $v_name = "s"; } else { $p_name = "wiki"; $v_name = "w"; } $includeDir = ".". DIRECTORY_SEPARATOR .$p_name. DIRECTORY_SEPARATOR; $includeDefault = $includeDir . "home.php"; if (isset($_GET[$v_name]) && !empty($_GET[$v_name])) { $_GET[$v_name] = str_replace("0", '', $_GET[$v_name]); $includeFile = basename(realpath($includeDir . $_GET[$v_name] . ".php")); $includePath = $includeDir . $includeFile; if (!empty($includeFile) && file_exists($includePath)) { include ($includePath); } else { include ($includeDefault); } } else { include ($includeDefault); } 1 ..الذي ولد ليكون أرماديلو، يموت حفر Link to comment Share on other sites More sharing options...
DontCare 1 Posted March 7, 2015 Author Share Posted March 7, 2015 if (!(empty($_GET['s'])) || empty($_GET['w'])) { $p_name = "pages"; $v_name = "s"; } else { $p_name = "wiki"; $v_name = "w"; } $includeDir = ".". DIRECTORY_SEPARATOR .$p_name. DIRECTORY_SEPARATOR; $includeDefault = $includeDir . "home.php"; if (isset($_GET[$v_name]) && !empty($_GET[$v_name])) { $_GET[$v_name] = str_replace("0", '', $_GET[$v_name]); $includeFile = basename(realpath($includeDir . $_GET[$v_name] . ".php")); $includePath = $includeDir . $includeFile; if (!empty($includeFile) && file_exists($includePath)) { include ($includePath); } else { include ($includeDefault); } } else { include ($includeDefault); } Thank you very much for you help. It is working very well. Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now