So I tried this:
Code: Select all
<?php
if ($_SERVERї'REQUEST_URI'] = "/index.php")
{
require("no.html");
}
else
require( $_GETї'action'] . ".html");
?>Any help on this or a better method?
Moderator: General Moderators
Code: Select all
<?php
if ($_SERVERї'REQUEST_URI'] = "/index.php")
{
require("no.html");
}
else
require( $_GETї'action'] . ".html");
?>It will always equal. You want to use double equal signs... Also, your else should have a bracket after it..And you should close the if statements with another bracket..Here is the revised code...Kazbaeden wrote:I'm pretty new to PHP so this stuff is probably pretty basic. What I'm trying to do is have a shell for the layout, and use require() to add content. When a user clicks on a link, the content should change.
So I tried this:
What my thought was, was taht the script would take the requested URL, and if it was index.php, it would include the default page. When a link was clicked, it would add ?action=URL to the URL of the page, and depending what was added, that file would be included. Apparantly this isn't working, because when the page reloads and ?action is on the end, the URI still equals "/index.php"Code: Select all
<?php if ($_SERVERї'REQUEST_URI'] = "/index.php") { require("no.html"); } else require( $_GETї'action'] . ".html"); ?>
Any help on this or a better method?
Code: Select all
<?php
if ($_SERVERї'REQUEST_URI'] == "/index.php") {
require("no.html");
} else {
require( $_GETї'action'] . ".html");
}
?>