|
• Tutorials: PHP: Making a default page Ever wondered how we make our site automatically load our news page when you go to "dbgtn.com/index.php" ? How can this be possible without calling the page("dbgtn.com/index.php?id=page")? I'll answer those questions in this tutorial, it's quite easy to learn too. Since we're using my site as an example i'll show you guys how to load "news.html" as your default. First off you should know that when you see the text "news" below it basically means news.html so you should replace it with whatever you're using(home.html, main.html, news.txt, e.t.c. Another thing you need to change is "dbgt" with whatever you're using like "id=", "tag=", "page=", e.t.c. <?php if(!$dbgt || $dbgt == ""){$dbgt = "news";} ?> <?php include("$dbgt.html"); ?> The first part of the script checks for the tag, in this case being "dbgt", if it is blank or is not called for when a visitor goes to index.php it replaces it with the default page being "news". Otherwise it will leave it alone. |