Gå til innhold

Hjelp til navigasjon!


Anbefalte innlegg

Skrevet

Hei!

 

Jeg fant et bra script på Hotscript.com

Det er sånn det skal virke...

 

Men på min side blir det sånn

 

Her er koden:

<?
if ($page == "page1"){ // "page1" can be set at what ever u want :)
$a = 1; 
$file = 1; // $file is the file which can be included :)
}elseif ($page == "page2"){ 
$b = 1;
$file = 2;
}elseif ($page == "page3"){
$c = 1;
$file = 3;
}elseif ($page == "page4"){
$d = 1;
$file = 4;
}elseif ($page == "page5"){
$e = 1;
$file = 5;
}elseif ($page == "page6"){
$f = 1;
$file = 6;
}else {
$a = 1;
$file = 1;
}

function nav($text,$unf,$num){
if ($unf == "1"){
 echo "<td bgcolor=#f8f8f8 width=100 height=16 rowspan=2 align=center><a href=\"unfnav.php?page=page".$num."\">".$text."</a></td>";
}else {
 echo "<td bgcolor=#e9e9e9 width=100 height=15 align=center><a href=\"unfnav.php?page=page".$num."\">".$text."</a></td>";
}
}

function nav2($bla){
if ($bla == "1"){
 echo "";
}else {
 echo "<td bgcolor=black width=100 height=1></td>";
}
}

?>
<html>
<head>
<style>
a {
text-decoration: none;
font-size: 11px;
font-family: verdana;
color: blue;
font-weight: bold;
}
</style>
</head>
<body>
<table cellspacing=0 cellpadding=0 border=0 align=center><tr><td bgcolor=black>
<table cellspacing=0 cellpadding=0 border=0>
<tr>
 <td bgcolor=black width=1 height=1></td>
 <td bgcolor=black width=100 height=1></td>
 <td bgcolor=black width=1 height=1></td>
 <td bgcolor=black width=100 height=1></td>
 <td bgcolor=black width=1 height=1></td>
 <td bgcolor=black width=100 height=1></td>
 <td bgcolor=black width=1 height=1></td>
 <td bgcolor=black width=100 height=1></td>
 <td bgcolor=black width=1 height=1></td>
 <td bgcolor=black width=100 height=1></td>
 <td bgcolor=black width=1 height=1></td>
 <td bgcolor=black width=100 height=1></td>
 <td bgcolor=black width=1 height=1></td>
</tr>
<tr>
 <td bgcolor=black width=1 height=15></td>
 <? nav(".: page 1 :.",$a,"1"); ?>
 <td bgcolor=black width=1 height=15></td>
 <? nav(".: page 2 :.",$b,"2"); ?>
 <td bgcolor=black width=1 height=15></td>
 <? nav(".: page 3 :.",$c,"3"); ?>
 <td bgcolor=black width=1 height=15></td>
 <? nav(".: page 4 :.",$d,"4"); ?>
 <td bgcolor=black width=1 height=15></td>
 <? nav(".: page 5 :.",$e,"5"); ?>
 <td bgcolor=black width=1 height=15></td>
 <? nav(".: page 6 :.",$f,"6"); ?>
 <td bgcolor=black width=1 height=15></td>
</tr>
<tr>
 <td bgcolor=black width=1 height=1></td>
 <? nav2($a); ?>
 <td bgcolor=black width=1 height=1></td>
 <? nav2($b); ?>
 <td bgcolor=black width=1 height=1></td>
 <? nav2($c); ?>
 <td bgcolor=black width=1 height=1></td>
 <? nav2($d); ?>
 <td bgcolor=black width=1 height=1></td>
 <? nav2($e); ?>
 <td bgcolor=black width=1 height=1></td>
 <? nav2($f); ?>
 <td bgcolor=black width=1 height=1></td>
</tr>
<tr>
 <td bgcolor=black width=1></td>
 <td bgcolor=#f8f8f8 colspan=11 align=center><br><font size=5 face=verdana>
 <b>Page 
 	<? 
 	echo $file; // it can be changed to include($file); :)
 	?> 
 </b>
 </font><br><br>
 </td>
 <td bgcolor=black width=1></td>
</tr>
<tr>
 <td bgcolor=black height=1 colspan=13></td>
</tr>
</table>
</td></tr></table>

</body>
</html>

Videoannonse
Annonse
Skrevet
Nei,

Det er linkene...

Det skriptet fungerer slik at den har all info i scirptet, den dynamiske url en

(siden.php?page=2)

 

Bestemmer hva som skal komme opp.

 

Du kan eventuelt legge til include()

 

(nede i scriptet)

 

<td bgcolor=#f8f8f8 colspan=11 align=center><br><font size=5 face=verdana>

<b>Page

  <?

include($file); // it can be changed to include($file); :)

  ?>

</b>

</font><br><br>

</td>

<td bgcolor=black width=1></td>

</tr>

<tr>

<td bgcolor=black height=1 colspan=13></td>

</tr>

</table>

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

 

</body>

</html>

Skrevet

Hei!

 

Jeg fant ut svaret!!

 

<?
if ($_GET['page'] == "page1"){ // "page1" can be set at what ever u want :)
$a = 1; 
$o = Hjem; // $file is the file which can be included :)
$mo = test;
$tekst = tesing;
}elseif ($_GET['page'] == "page2"){ 
$b = 1;
$o = Bilder;
$mo = test;
$tekst = tesing;
}elseif ($_GET['page'] == "page3"){
$c = 1;
$o = Mira;
$mo = test;
$tekst = tesing;
}elseif ($_GET['page'] == "page4"){
$d = 1;
$o = Nuddel;
$mo = test;
$tekst = tesing;
}elseif ($_GET['page'] == "page5"){
$e = 1;
$o = 5;
$mo = test;
$tekst = tesing;
}elseif ($_GET['page'] == "page6"){
$f = 1;
$o = 6;
$mo = test;
$tekst = tesing;
}else {
$a = 1;
$o = 1;
$mo = test;
$tekst = tesing;
}

function nav($text,$unf,$num){
if ($unf == "1"){
 echo "<td bgcolor=#f8f8f8 width=100 height=16 rowspan=2 align=center><a href=\"unfnav.php?page=page".$num."\">".$text."</a></td>";
}else {
 echo "<td bgcolor=#e9e9e9 width=100 height=15 align=center><a href=\"unfnav.php?page=page".$num."\">".$text."</a></td>";
}
}

function nav2($bla){
if ($bla == "1"){
 echo "";
}else {
 echo "<td bgcolor=black width=100 height=1></td>";
}
}

?>
<html>
<head>
<style>
font.o { font-size: 30px; font-family: verdana; font-weight: bold; }
font.mo { font-size: 13px; font-family: verdana; font-weight: bold; }
font.tekst { font-size: 12px; font-family: verdana; font-weight: normal; }
a { text-decoration: none; font-size: 11px; font-family: verdana; color: blue; font-weight: bold; }
</style>
</head>
<body>
<center>
<table cellspacing=0 cellpadding=0 border=0 align=center>
<table cellspacing=0 cellpadding=0 border=0>
<tr>
 <td bgcolor=black width=1 height=1></td>
 <td bgcolor=black colspan=11 width=100 height=1></td>
</tr>
<tr>
 <td bgcolor=black width=1 height=1></td>
 <td bgcolor=#f8f8f8 colspan=11 width=100 height=30 align=center><b><font size=15 face=verdana>Ingvilds hjemmeside</font></b></td>
 <td bgcolor=black width=1 height=1></td>
</tr>
<tr>
 <td bgcolor=black width=1 height=1></td>
 <td bgcolor=black width=100 height=1></td>
 <td bgcolor=black width=1 height=1></td>
 <td bgcolor=black width=100 height=1></td>
 <td bgcolor=black width=1 height=1></td>
 <td bgcolor=black width=100 height=1></td>
 <td bgcolor=black width=1 height=1></td>
 <td bgcolor=black width=100 height=1></td>
 <td bgcolor=black width=1 height=1></td>
 <td bgcolor=black width=100 height=1></td>
 <td bgcolor=black width=1 height=1></td>
 <td bgcolor=black width=100 height=1></td>
 <td bgcolor=black width=1 height=1></td>
</tr>
<tr>
 <td bgcolor=black width=1 height=15></td>
 <? nav(".: Hjem :.",$a,"1"); ?>
 <td bgcolor=black width=1 height=15></td>
 <? nav(".: Bilder :.",$b,"2"); ?>
 <td bgcolor=black width=1 height=15></td>
 <? nav(".: Mira :.",$c,"3"); ?>
 <td bgcolor=black width=1 height=15></td>
 <? nav(".: Nuddel :.",$d,"4"); ?>
 <td bgcolor=black width=1 height=15></td>
 <? nav(".: page 5 :.",$e,"5"); ?>
 <td bgcolor=black width=1 height=15></td>
 <? nav(".: page 6 :.",$f,"6"); ?>
 <td bgcolor=black width=1 height=15></td>
</tr>
<tr>
 <td bgcolor=black width=1 height=1></td>
 <? nav2($a); ?>
 <td bgcolor=black width=1 height=1></td>
 <? nav2($b); ?>
 <td bgcolor=black width=1 height=1></td>
 <? nav2($c); ?>
 <td bgcolor=black width=1 height=1></td>
 <? nav2($d); ?>
 <td bgcolor=black width=1 height=1></td>
 <? nav2($e); ?>
 <td bgcolor=black width=1 height=1></td>
 <? nav2($f); ?>
 <td bgcolor=black width=1 height=1></td>
</tr>
<tr>
 <td bgcolor=black width=1></td>
 <td bgcolor=#f8f8f8 colspan=11 align=center><br><font class=o>
 <b>
 	<? 
 	echo $o;
 	?> 
 </b><br><br></font>
 <font class=mo>
 <b>
 	<?
 	echo $mo
 	?>
 </b></font><br><br>
 <font class=tekst>
 	<?
 	echo $tekst
 	?>
 </font><br><br>
 </td>
 <td bgcolor=black width=1></td>
</tr>
<tr>
 <td bgcolor=black height=1 colspan=13></td>
</tr>
</table>
</td></tr></table>
</center>
</body>
</html>

 

Helt øverst har jeg noen variabler som heter $o (for overskrift), $mo (for mellomoverskrift), og $tekst (ja, det sier seg selv...). Og nesten nederst har jeg satt inn diss variablene. Men disse men der hvor jeg skriver f.eks. $tekst = Her er all teksten. Da får jeg feil, men hvis jeg skriver: $tekst = dettevirkerikke. Så virker det... Altsa det går ikke med mellomrom... vet noen hvordan jeg kan få fikse mitt problem??

Skrevet

Du bør skrive ' eller " rundt teksten om du skal sette en string til noe.

 

I ditt tilfelle blir det:

$tekst = 'Her er all teksten.'

Skrevet

Jepp.

 

Husk at PHP gjør jobben på server, og sender et ferdig resultat til browseren din.

 

echo(); vil altså sende noe direktet til browsere, og da er det opp til browserer og lese og tolke hva som blir sendt ;)

Opprett en konto eller logg inn for å kommentere

Du må være et medlem for å kunne skrive en kommentar

Opprett konto

Det er enkelt å melde seg inn for å starte en ny konto!

Start en konto

Logg inn

Har du allerede en konto? Logg inn her.

Logg inn nå
  • Hvem er aktive   0 medlemmer

    • Ingen innloggede medlemmer aktive
×
×
  • Opprett ny...