Jump to content
php.lv forumi

index faila problemas..


millers

Recommended Posts

  • Replies 53
  • Created
  • Last Reply

Top Posters In This Topic

domajams kljuda atrodas sheit

 

<?php
  if(isset($_GET['tag']) && $_GET['tag'] == 'login')
  {
  include('inc/erroru.php');
  }
  elseif(isset($_GET['tag']) && $_GET['tag'] == 'Reg')
  {
  include('reg/register.php');
  }
  elseif(isset($_GET['tag']) && $_GET['tag'] == 'home')
  {
  include('index.php');
  }
  elseif(isset($_GET['tag']) && $_GET['tag'] == 'bug')
  {
  include('bugfix.php');
  }
  elseif(isset($_GET['tag']) && $_GET['tag'] == 'sms')
  {
  include('inc/erroru.php');
  }
  elseif(isset($_GET['tag']) && $_GET['tag'] == 'about')
  {
  include('about.php');
  }
  elseif(isset($_GET['tag']) && $_GET['tag'] == 'contact')
  {
  include('contact.php');
  }
  elseif(isset($_GET['tag']) && $_GET['tag'] == 'download')
  {
  include('download.php');
  }
  elseif(isset($_GET['tag']) && $_GET['tag'] == 'video')
  {
  include('video.php');
  }
  elseif(isset($_GET['tag']) && $_GET['tag'] == 'muzika')
  {
  include('muzika.php');
  }
?>

Link to comment
Share on other sites

labak sadi

switch (trim($_GET['tag']))  
{
 case 'bla1':
 $contents='bla1.php';  
 $virsraksts='BLA1';
 break;

 case 'bla2':
 $contents='bla2.php';  
 $virsraksts='BLA2';
  break;
//  turpini  case: 'aa'   ... break;  cik nepieciesams

  default:
shis izpildisies ja nebuus nekas padots ar get, vai arii netiks atrasta sakritiba tb. varetu buut pirmaa lapa....
$contents='bla.php';  
$virsraksts='BLA';
}
?>

HTMLs
...... te teiksim virsraksts ... vai kas cits
<?php echo $virsraksts; ?>

atkal HTML
<?php
include($contents);
?>
...  turpinas HTML

 

Shadi bus daudz parskatamak un arii vairak vai mazak PHP atdaliits no HTML ...

ka arii ir taads nerakstiits likums ja iespeju vairak par 5-6 tad izmanto Switch konstrukciju ....

 

Edit:

es saprotu ko tas nozime skriptus es saprotu ko nozime bet pats vell laaaga nemaku vinjus rakstiiiti ...

tas ir kaa nemaki , ja saproti ?

if(ja nosacijums ir patiess)

{

}

else // ja nosacijums nav patiess...

{

}

-- > ta tava konstrukcija nav nekas cits kaa shiis pats tikai salikts rindinjaa...

Edited by Grey_Wolf
Link to comment
Share on other sites

millers --> tas mans kods izpildes zinja netskjiras no taa ieprieksejaa, vienkarshi parskatamaks un eertaaks (vieglak modificet utt...)

takaa meklee vien kur tev ir kljuudas, kaa arii iesleedz arror reportingu ....

P.S. aiz defolt: vari ielikt kautvai echo 'aaa nekas netika atrasts'; ;)

Link to comment
Share on other sites


×
×
  • Create New...