- This topic is empty.
-
AuthorPosts
-
March 19, 2013 at 4:47 pm #128821CrocoDillonParticipant
Change `switch ($_GET) {` to `switch ($_SERVER) {`
If that doesn’t work try `var_dump($_SERVER)` and see what you get.
March 19, 2013 at 4:56 pm #128823rpotterjrParticipantNo change…
March 19, 2013 at 5:03 pm #128824CrocoDillonParticipantSo, what did `var_dump` get you?
March 19, 2013 at 5:04 pm #128825rpotterjrParticipantNothing different. I tried restarting the server and clearing browser cache…
No change..
March 19, 2013 at 5:08 pm #128826rpotterjrParticipantI was at this stage before without the Virtual Server by specifying the root in php, but couldn’t ever get past this problem…
March 19, 2013 at 5:13 pm #128828CrocoDillonParticipantPut `var_dump($_SERVER)` in you index.php file (before the switch), and show me what it gives with and without the .htaccess file.
March 19, 2013 at 5:17 pm #128829ArgeauxParticipantMaybe you have to enable mod_rewrite in your apache install.
March 19, 2013 at 5:24 pm #128830rpotterjrParticipantI have mod_rewrite enabled. As for the var_dump($_SERVER), nothing is different. Just back at square one again…
March 19, 2013 at 5:27 pm #128831CrocoDillonParticipantNothing is different doesn’t give me much info to work with.
March 19, 2013 at 5:28 pm #128832rpotterjrParticipantI can make the var_dump($_SERVER)
before the switch/case in a separate statement, but all that does is display a count of the character length of each link clicked.
March 19, 2013 at 5:29 pm #128833rpotterjrParticipantThe address changes through:
rpotterjr.dev/about
and
rpotterjr.dev/contact
However, the content stays stuck on the home page’s content.
If I revert back to not having the rewrite, I can navigate from page to page changing the content, but the address displays as http://rpotterjr.dev/index.php?page=about. This is with or without var_dump($_SERVER)
March 19, 2013 at 5:31 pm #128834rpotterjrParticipantSo here is my code currently:
.htaccess
RewriteEngine OnRewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?$1 [NC,L]March 19, 2013 at 5:33 pm #128835rpotterjrParticipantPHP case/switch
$_GET = null;
switch ($_GET) {
case “portfolio”:
include(‘theme/default/pages/portfolio.php’);
break;case “resume”:
include(‘theme/default/pages/resume.php’);
break;case “about”:
include(‘theme/default/pages/about.php’);
break;case “contact”:
include(‘theme/default/pages/contact.php’);
break;
// Default Page
default:
include(‘theme/default/pages/home.php’);
break;
}?>
March 19, 2013 at 5:33 pm #128836March 19, 2013 at 5:33 pm #128837CrocoDillonParticipantThe I guess QUERY_STRING just reads the URL instead of using the internal rewriting. Try `var_dump($_GET)` (with .htaccess) to see if the ‘page’ key (it won’t be called page unless you change the .htaccess file) is in there. If it is, you can use something like `if (isset($_GET)) {…}` etc.
-
AuthorPosts
- The forum ‘Back End’ is closed to new topics and replies.