Jump to content
php.lv forumi

Includes . Kaa?


TurboSasa

Recommended Posts

Situaacija taada ka man ir kaadas 6 lapas kur apkaart ir vinaada infa bet centraa cita, taatad man vajadzeetu izmantot include lai tanii centraalajaa tabulaa ievietotu kaadu infu kaadu man vajag, jautajums taads kaa man to izdariit, veelams ar uzskataamu piemeeru paradiit kas un kaa.

Link to comment
Share on other sites

// shei seko viss HTML kods
<html>
<head>
....
<a href="lapa.php?include=1">Lapa 1</a>
<a href="lapa.php?include=2">Lapa 2</a>
<a href="lapa.php?include=3">Lapa 3</a>
//inkluudojam centra koda lapu
if($include==1){
     require('lapa_1.html');
} else if($include==2'){
    require('lapa_2.html);
} else {
    require('lapa_1.html'); // šis ir tāpēc, ja nav dots $include vins inclūdos lapa_1.html
}

//turpinam nobeidzam vienaado kodu..
...
</body>
</html>

Link to comment
Share on other sites

Vai arii ja vairaak tad var nelietot if bet gan switch:

 

<?

switch($_GET['id']) {
   case 'aaa':
       include('fails1.php');
       break;
   case 'bbb':
       include('fails2.php');
       break;
   default:
       include('fails1.php');
       break;
};
?>

<a href='?id=aaa'>Fails1</a>
<a href='?id=bbb'>Fails2</a>

Link to comment
Share on other sites

incluudes es taakaa tagad sapratu bet kaa man panaakt lai no incluudes inkluudeejamais fails inkuudeetos centraalakaa tabulaa:

----------------------------

|.................................|

----------------------------

-----.----------------.-----

|....| |. include......| |...|

|....| |. ejamie......| |....|

|....| |..................| |....|

|....| |.fali.............| |....|

-----.---------------.-----

---------------------------

|................................|

---------------------------

 

ja var saprast tad taa ir tabulu sheemaa kaa ir manaa lapaa un kur rakstiits, tur ir jaainkuudee. (ceru ka to sheemu var saprast)

Edited by TurboSasa
Link to comment
Share on other sites

<table><tr><td colspan="2">augsha</td></tr>

<tr><td><a href="lapa.php?in=1">Lapa 1</a><br>

<a href="lapa.php?in=2">Lapa 2</a><br>

<a href="lapa.php?in=3">Lapa 3</a><br></td></tr>

<td>

<? if (isset ($_GET['in'])) {$sa=$_GET['in']; include "lapa_".$sa.".php";}

?>

</td></tr></table>

Link to comment
Share on other sites

×
×
  • Create New...