index.php

  • tastysite
  • Proficient
  • Proficient
  • User avatar
  • Posts: 349
  • Loc: Brighouse, West Yorkshire, England

Post 3+ Months Ago

Hi just a quick one I want index.php?page=home to be my index page and not just index.php how would I do that?
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • righteous_trespasser
  • Scuffle
  • Genius
  • User avatar
  • Posts: 6230
  • Loc: South-Africa

Post 3+ Months Ago

I would add a little piece of code to the top of the page ... something like this:
Code: [ Select ]
<?php
if(isset($_GET["page"])){
//do nothing, the page variable has already been set
}
else{
$_GET["page"] = "home";
}
?>
  1. <?php
  2. if(isset($_GET["page"])){
  3. //do nothing, the page variable has already been set
  4. }
  5. else{
  6. $_GET["page"] = "home";
  7. }
  8. ?>
  • Truce
  • Guru
  • Guru
  • Truce
  • Posts: 1477
  • Loc: Washington DC

Post 3+ Months Ago

righteous_trespasser wrote:
I would add a little piece of code to the top of the page ... something like this:
Code: [ Select ]
<?php
if(isset($_GET["page"])){
  //do nothing, the page variable has already been set
}
else{
  $_GET["page"] = "home";
}
?>
  1. <?php
  2. if(isset($_GET["page"])){
  3.   //do nothing, the page variable has already been set
  4. }
  5. else{
  6.   $_GET["page"] = "home";
  7. }
  8. ?>


Or quit wasting space and use the ternary operator (same as above):
PHP Code: [ Select ]
$_GET['page'] = $_GET['page'] ? $_GET['page'] : 'home';

Post Information

  • Total Posts in this topic: 3 posts
  • Users browsing this forum: No registered users and 68 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
cron
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.