/ Forside / Teknologi / Udvikling / PHP / Nyhedsindlæg
Login
Glemt dit kodeord?
Brugernavn

Kodeord


Reklame
Top 10 brugere
PHP
#NavnPoint
rfh 3959
natmaden 3372
poul_from 3310
funbreak 2700
stone47 2230
Jin2k 1960
Angband 1743
Bjerner 1249
refi 1185
10  Interkril.. 1146
Simpel menu
Fra : Henrik Simonsen


Dato : 14-05-03 18:32

Jeg er ikke nogen hård programmør, men vil gerne lige gøre brug af lidt php
til en menu, da jeg så let kan templateopbygge sitet uden at skulle have
adskillige versioner af menuen liggende.

Nå, til sagen selv om det er lidt pinligt, men jeg kan f.... Ikke få dette
til at du, selv om det vel egentlig er det mest simple man kan lave...

Mvh
Henrik
-------------------------
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<table width="500" border="1" cellpadding="2" cellspacing="0"
bordercolor="#000000">
<tr>
<td width="160" bgcolor="b2cbac"><table width="100%" border="0"
cellspacing="0" cellpadding="2">
<tr>
<td width="20"><img src="gfx/arrow-down.gif" width="16"
height="16"></td>
<td><a href="/index.php?menu=mgraphics">mgraphics</a></td>
</tr>
<tr>
<td width="20"><img src="gfx/arrow-down.gif" width="16"
height="16"></td>
<td><a href="/webhosting.php?menu=webhosting">webhosting</a></td>
</tr>
<tr>
<td width="20"><img src="gfx/arrow-down.gif" width="16"
height="16"></td>
<td><a
href="/serverhosting.php?menu=serverhosting">serverhosting</a></td>
</tr>
<tr>
<td width="20"><img src="gfx/arrow-down.gif" width="16"
height="16"></td>
<td><a href="/kontakt.php?menu=kontakt">kontakt</a></td>
</tr>
<tr>
<td width="20"><img src="gfx/arrow-down.gif" width="16"
height="16"></td>
<td><a href="/support.php?menu=support">support</a></td>
</tr>
<tr>
<td width="20"><img src="gfx/arrow-down.gif" width="16"
height="16"></td>
<td><a href="/drift.php?menu=drift">drift</a></td>
</tr>
</table></td>
<td>&nbsp;</td>
</tr>
<tr>
<td width="160" bgcolor="b2cbac">

<?
$menu= drift;
//<!--MENU mgraphics -->
if ($menu = 0 OR $menu= mgraphics) echo'
<table width="100%" border="0" cellspacing="0" cellpadding="2">
<tr>
<td width="20"><img src="gfx/arrow-right.gif" width="16"
height="16"></td>
<td>forside</td>
</tr>
<tr>
<td width="20"><img src="gfx/arrow-right.gif" width="16"
height="16"></td>
<td>profil</td>
</tr>
<tr>
<td width="20"><img src="gfx/arrow-right.gif" width="16"
height="16"></td>
<td>forretningsbetingelser</td>
</tr>
</table>
';

//<!--MENU webhosting -->
if ($menu = webhosting) echo'
<table width="100%" border="0" cellspacing="0" cellpadding="2">
<tr>
<td width="20"><img src="gfx/arrow-right.gif" width="16"
height="16"></td>
<td>dom&aelig;ner</td>
</tr>
<tr>
<td width="20"><img src="gfx/arrow-right.gif" width="16"
height="16"></td>
<td>hoteloversigt</td>
</tr>
</table>
';


//<!--MENU serverhosting -->
if ($menu = serverhosting)
{
echo'<table width="100%" border="0" cellspacing="0" cellpadding="2">
<tr>
<td width="20"><img src="gfx/arrow-right.gif" width="16"
height="16"></td>
<td>info</td>
</tr>
<tr>
<td width="20"><img src="gfx/arrow-right.gif" width="16"
height="16"></td>
<td>servere</td>
</tr>
<tr>
<td width="20"><img src="gfx/arrow-right.gif" width="16"
height="16"></td>
<td>priser</td>
</tr>
<tr>
<td width="20"><img src="gfx/arrow-right.gif" width="16"
height="16"></td>
<td>reseller</td>
</tr>
</table>
';
}

//<!--MENU support -->
if ($menu = support) echo'
<table width="100%" border="0" cellspacing="0" cellpadding="2">
<tr>
<td width="20"><img src="gfx/arrow-right.gif" width="16"
height="16"></td>
<td>mail</td>
</tr>
<tr>
<td width="20"><img src="gfx/arrow-right.gif" width="16"
height="16"></td>
<td>ftp</td>
</tr>
<tr>
<td width="20"><img src="gfx/arrow-right.gif" width="16"
height="16"></td>
<td>mysql</td>
</tr>
<tr>
<td width="20"><img src="gfx/arrow-right.gif" width="16"
height="16"></td>
<td>scripts</td>
</tr>
</table>
';

//<!--MENU drift -->
if ($menu = drift) echo'
<table width="100%" border="0" cellspacing="0" cellpadding="2">
<tr>
<td width="20"><img src="gfx/arrow-right.gif" width="16"
height="16"></td>
<td>driftmeddelelser</td>
</tr>
<tr>
<td width="20"><img src="gfx/arrow-right.gif" width="16"
height="16"></td>
<td>driftstatus</td>
</tr>
</table>
';
?>

<p>&nbsp;</p></td>
<td>&nbsp;</td>
</tr>
</table>
</body>
</html>


 
 
Henrik Simonsen (14-05-2003)
Kommentar
Fra : Henrik Simonsen


Dato : 14-05-03 18:54

Jeg sagde jo det var simpelt

Der skal selvfølgelig ved alle "if ($menu" være to "=="

Nå, undskyld forstyrrelsen

Mvh
Henrik

On 14/05/03 19:31, in article BAE84A1F.3549%info@fjern-dette.mgraphics.dk,
"Henrik Simonsen" <info@fjern-dette.mgraphics.dk> wrote:

> Jeg er ikke nogen hård programmør, men vil gerne lige gøre brug af lidt php
> til en menu, da jeg så let kan templateopbygge sitet uden at skulle have
> adskillige versioner af menuen liggende.
>
> Nå, til sagen selv om det er lidt pinligt, men jeg kan f.... Ikke få dette
> til at du, selv om det vel egentlig er det mest simple man kan lave...
>
> Mvh
> Henrik
> -------------------------
> <html>
> <head>
> <title>Untitled Document</title>
> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
> </head>
>
> <body>
> <table width="500" border="1" cellpadding="2" cellspacing="0"
> bordercolor="#000000">
> <tr>
> <td width="160" bgcolor="b2cbac"><table width="100%" border="0"
> cellspacing="0" cellpadding="2">
> <tr>
> <td width="20"><img src="gfx/arrow-down.gif" width="16"
> height="16"></td>
> <td><a href="/index.php?menu=mgraphics">mgraphics</a></td>
> </tr>
> <tr>
> <td width="20"><img src="gfx/arrow-down.gif" width="16"
> height="16"></td>
> <td><a href="/webhosting.php?menu=webhosting">webhosting</a></td>
> </tr>
> <tr>
> <td width="20"><img src="gfx/arrow-down.gif" width="16"
> height="16"></td>
> <td><a
> href="/serverhosting.php?menu=serverhosting">serverhosting</a></td>
> </tr>
> <tr>
> <td width="20"><img src="gfx/arrow-down.gif" width="16"
> height="16"></td>
> <td><a href="/kontakt.php?menu=kontakt">kontakt</a></td>
> </tr>
> <tr>
> <td width="20"><img src="gfx/arrow-down.gif" width="16"
> height="16"></td>
> <td><a href="/support.php?menu=support">support</a></td>
> </tr>
> <tr>
> <td width="20"><img src="gfx/arrow-down.gif" width="16"
> height="16"></td>
> <td><a href="/drift.php?menu=drift">drift</a></td>
> </tr>
> </table></td>
> <td>&nbsp;</td>
> </tr>
> <tr>
> <td width="160" bgcolor="b2cbac">
>
> <?
> $menu= drift;
> //<!--MENU mgraphics -->
> if ($menu = 0 OR $menu= mgraphics) echo'
> <table width="100%" border="0" cellspacing="0" cellpadding="2">
> <tr>
> <td width="20"><img src="gfx/arrow-right.gif" width="16"
> height="16"></td>
> <td>forside</td>
> </tr>
> <tr>
> <td width="20"><img src="gfx/arrow-right.gif" width="16"
> height="16"></td>
> <td>profil</td>
> </tr>
> <tr>
> <td width="20"><img src="gfx/arrow-right.gif" width="16"
> height="16"></td>
> <td>forretningsbetingelser</td>
> </tr>
> </table>
> ';
>
> //<!--MENU webhosting -->
> if ($menu = webhosting) echo'
> <table width="100%" border="0" cellspacing="0" cellpadding="2">
> <tr>
> <td width="20"><img src="gfx/arrow-right.gif" width="16"
> height="16"></td>
> <td>dom&aelig;ner</td>
> </tr>
> <tr>
> <td width="20"><img src="gfx/arrow-right.gif" width="16"
> height="16"></td>
> <td>hoteloversigt</td>
> </tr>
> </table>
> ';
>
>
> //<!--MENU serverhosting -->
> if ($menu = serverhosting)
> {
> echo'<table width="100%" border="0" cellspacing="0" cellpadding="2">
> <tr>
> <td width="20"><img src="gfx/arrow-right.gif" width="16"
> height="16"></td>
> <td>info</td>
> </tr>
> <tr>
> <td width="20"><img src="gfx/arrow-right.gif" width="16"
> height="16"></td>
> <td>servere</td>
> </tr>
> <tr>
> <td width="20"><img src="gfx/arrow-right.gif" width="16"
> height="16"></td>
> <td>priser</td>
> </tr>
> <tr>
> <td width="20"><img src="gfx/arrow-right.gif" width="16"
> height="16"></td>
> <td>reseller</td>
> </tr>
> </table>
> ';
> }
>
> //<!--MENU support -->
> if ($menu = support) echo'
> <table width="100%" border="0" cellspacing="0" cellpadding="2">
> <tr>
> <td width="20"><img src="gfx/arrow-right.gif" width="16"
> height="16"></td>
> <td>mail</td>
> </tr>
> <tr>
> <td width="20"><img src="gfx/arrow-right.gif" width="16"
> height="16"></td>
> <td>ftp</td>
> </tr>
> <tr>
> <td width="20"><img src="gfx/arrow-right.gif" width="16"
> height="16"></td>
> <td>mysql</td>
> </tr>
> <tr>
> <td width="20"><img src="gfx/arrow-right.gif" width="16"
> height="16"></td>
> <td>scripts</td>
> </tr>
> </table>
> ';
>
> //<!--MENU drift -->
> if ($menu = drift) echo'
> <table width="100%" border="0" cellspacing="0" cellpadding="2">
> <tr>
> <td width="20"><img src="gfx/arrow-right.gif" width="16"
> height="16"></td>
> <td>driftmeddelelser</td>
> </tr>
> <tr>
> <td width="20"><img src="gfx/arrow-right.gif" width="16"
> height="16"></td>
> <td>driftstatus</td>
> </tr>
> </table>
> ';
> ?>
>
> <p>&nbsp;</p></td>
> <td>&nbsp;</td>
> </tr>
> </table>
> </body>
> </html>
>


Tonny Jørgensen (15-05-2003)
Kommentar
Fra : Tonny Jørgensen


Dato : 15-05-03 00:13


"Henrik Simonsen" <info@fjern-dette.mgraphics.dk> wrote in message
news:BAE84F62.354F%info@fjern-dette.mgraphics.dk...
> Jeg sagde jo det var simpelt
>
> Der skal selvfølgelig ved alle "if ($menu" være to "=="
>
> Nå, undskyld forstyrrelsen
>
> Mvh
> Henrik
>
og husk også det skal være if($noget == "tis") { gør noget } du havde glemt
de der brackets før din echo.

- Tonny, www.jegergud.dk



No1 (15-05-2003)
Kommentar
Fra : No1


Dato : 15-05-03 00:58

> og husk også det skal være if($noget == "tis") { gør noget } du havde
glemt
> de der brackets før din echo.

Det er ikke nødvendigt, men det ser pænere ud og er nemmere at vedligeholde,
hvis det fx skrives:

if ($noget=="æblemost") {
$person->drik();
} else {
$person->sig("Jeg drikker kun æblemost");
}

fremfor

if ($noget=="æblemost") $person->drik();
else $person->sig("Jeg drikker kun æblemost");



Søg
Reklame
Statistik
Spørgsmål : 177560
Tips : 31968
Nyheder : 719565
Indlæg : 6408946
Brugere : 218888

Månedens bedste
Årets bedste
Sidste års bedste