.htacces

Gestart doorDesire46 reacties150 weergaven

47 berichten · pagina 3 van 4

Desire

Lid · Topicstarter

Berichten
4.367
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Ik snap dat hele switch gebeuren niet, is dat echt nodig?
0
Berichten
10.421
Reputatie
4
Punten
0,00
Lid sinds
Laatst gezien
Ik kan het zeker aanraden. Een array zou je ook kunnen gebruiken.
0
Desire

Lid · Topicstarter

Berichten
4.367
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Kun je een voorbeeld laten zien met array? want switch snap ik geen hol van en heb alles al afgezocht naar switch maar niks goeds kunnen vinden.
0
Berichten
10.421
Reputatie
4
Punten
0,00
Lid sinds
Laatst gezien
Array:

[COLOR= #0000BB]<?php
$allowed_pages[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/array"]array[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]home[/COLOR][COLOR= #007700],[/COLOR][COLOR= #DD0000]contact[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]information[/COLOR][COLOR= #007700]);[/COLOR]
[URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]([/COLOR][URL="http://www.php.net/in_array"]in_array[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]p[/COLOR][COLOR= #007700]],[/COLOR][COLOR= #0000BB]$allowed_pages[/COLOR][COLOR= #007700])) {[/COLOR]
 [URL="http://www.php.net/include"]include[/URL] [COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]p[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]".php"[/COLOR][COLOR= #007700];
}[/COLOR] [URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR]
 [URL="http://www.php.net/include"]include[/URL] [COLOR= #DD0000]"404.php"[/COLOR][COLOR= #007700];
}[/COLOR]


Switch:

[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/switch"]switch[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]p[/COLOR][COLOR= #007700]]) {
  case[/COLOR] [COLOR= #DD0000]"home"[/COLOR][COLOR= #007700]:[/COLOR]
   [URL="http://www.php.net/include"]include[/URL] [COLOR= #DD0000]"home.php"[/COLOR][COLOR= #007700];[/COLOR]
   [URL="http://www.php.net/break"]break[/URL][COLOR= #007700];
  case[/COLOR] [COLOR= #DD0000]"contact"[/COLOR][COLOR= #007700]:[/COLOR]
   [URL="http://www.php.net/include"]include[/URL] [COLOR= #DD0000]"contact.php"[/COLOR][COLOR= #007700];[/COLOR]
   [URL="http://www.php.net/break"]break[/URL][COLOR= #007700];
  case[/COLOR] [COLOR= #DD0000]"information"[/COLOR][COLOR= #007700]:[/COLOR]
   [URL="http://www.php.net/include"]include[/URL] [COLOR= #DD0000]"information.php"[/COLOR][COLOR= #007700];[/COLOR]
   [URL="http://www.php.net/break"]break[/URL][COLOR= #007700];
  default:[/COLOR]
   [URL="http://www.php.net/include"]include[/URL] [COLOR= #DD0000]"404.php"[/COLOR][COLOR= #007700];[/COLOR]
   [URL="http://www.php.net/break"]break[/URL][COLOR= #007700];
}[/COLOR]
?>


toevoeging op 5 april 2012, 191549:
Desire schreef:
want switch snap ik geen hol van en heb alles al afgezocht naar switch maar niks goeds kunnen vinden.
Dan heb je vast geen php.net bekeken wink. Het staat daar vrij duidelijk uitgelegd....
0
Desire

Lid · Topicstarter

Berichten
4.367
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Parse error: syntax error, unexpected T_BREAK in D:xampphtdocspaginaindex.php on line 14
Bij switch

toevoeging op 5 april 2012, 191933:
En bij Array:
http://paypal-koopjes.nl/test/
0
Berichten
10.421
Reputatie
4
Punten
0,00
Lid sinds
Laatst gezien
kopie-pasta eens opnieuw, zaten enkele fouten in. case heeft dubbele punt, en verder worden er punt-kommas gebruikt as usual.

idem dito voor die array, parameters waren verwisseld... (zit ook geen logica in vergeleken met andere functies emo)
Moet nu als het goed is prima werken?
0
Desire

Lid · Topicstarter

Berichten
4.367
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Werkt nog niet:
http://paypal-koopjes.nl/test/index.php

toevoeging op 5 april 2012, 19:26:26:
Op diensten staat andere tekst, en info bestaat niet.
0
Berichten
10.421
Reputatie
4
Punten
0,00
Lid sinds
Laatst gezien
Desire schreef:
Werkt nog niet:
http://paypal-koopjes.nl/test/index.php

Is dit je array of switch versie? Waar is je GET-parameter in je URL?
Je moet uiteraard bij beide deze wel toevoegen.... Dit is een uitbreiding op mijn eerdere gegeven code.
toevoeging op 5 april 2012, 19:34:02:
index.php includeren in je index.php lijkt me niet verstandig wink
0
Desire

Lid · Topicstarter

Berichten
4.367
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Aarclay schreef:
Eerdere citaten tonen
Desire schreef:
Werkt nog niet:
http://paypal-koopjes.nl/test/index.php

Je moet uiteraard bij beide deze wel toevoegen.... Dit is een uitbreiding op mijn eerdere gegeven code.
Hoe bedoel je.

toevoeging op 5 april 2012, 19:35:55:
Bedoel je dit?:

if (file_exists(paginas/ . $_GET[page] . .php)) {
        include(paginas/ . $_GET[page] . .php);
    }else{
            include(paginas/404.php);
        }


toevoeging op 5 april 2012, 19:37:17:
Ik heb nu dit:

[COLOR= #0000BB]<?php[/COLOR]

[URL="http://www.php.net/switch"]switch[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]p[/COLOR][COLOR= #007700]]) {
  case[/COLOR] [COLOR= #DD0000]"home"[/COLOR][COLOR= #007700]:[/COLOR]
   [URL="http://www.php.net/include"]include[/URL] [COLOR= #DD0000]"index.php"[/COLOR][COLOR= #007700];[/COLOR]
   [URL="http://www.php.net/break"]break[/URL][COLOR= #007700];
  case[/COLOR] [COLOR= #DD0000]"info"[/COLOR][COLOR= #007700]:[/COLOR]
   [URL="http://www.php.net/include"]include[/URL] [COLOR= #DD0000]"info.php"[/COLOR][COLOR= #007700];[/COLOR]
   [URL="http://www.php.net/break"]break[/URL][COLOR= #007700];
  case[/COLOR] [COLOR= #DD0000]"diensten"[/COLOR][COLOR= #007700]:[/COLOR]
   [URL="http://www.php.net/include"]include[/URL] [COLOR= #DD0000]"diensten.php"[/COLOR][COLOR= #007700];[/COLOR]
   [URL="http://www.php.net/break"]break[/URL][COLOR= #007700];
  default:[/COLOR]
   [URL="http://www.php.net/include"]include[/URL] [COLOR= #DD0000]"paginas/404.php"[/COLOR][COLOR= #007700];[/COLOR]
   [URL="http://www.php.net/break"]break[/URL][COLOR= #007700];
}[/COLOR]
    [URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]([/COLOR][URL="http://www.php.net/file_exists"]file_exists[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]paginas/[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]p[/COLOR][COLOR= #007700]] .[/COLOR] [COLOR= #DD0000].php[/COLOR][COLOR= #007700])) {[/COLOR]
        [URL="http://www.php.net/include"]include[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]paginas/[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]p[/COLOR][COLOR= #007700]] .[/COLOR] [COLOR= #DD0000].php[/COLOR][COLOR= #007700]);
    }[/COLOR][URL="http://www.php.net/else"]else[/URL][COLOR= #007700]{[/COLOR]
            [URL="http://www.php.net/include"]include[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]paginas/404.php[/COLOR][COLOR= #007700]);
        }[/COLOR] 
    [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/empty"]empty[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_SESSION[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]normal[/COLOR][COLOR= #007700]])){[/COLOR] 
?>

<!DOCTYPE html>
<html>
<head>
    <title> Test </title>
</head>
<body>
hoi
    <br />
    <br />
    <strong> Menu </strong>
    <br />
    [COLOR= #0000BB]<?php[/COLOR]
    [URL="http://www.php.net/include"]include[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]paginas/menu.php[/COLOR][COLOR= #007700]);
    }[/COLOR] 
?>
</body>
</html>
0
Desire

Lid · Topicstarter

Berichten
4.367
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Naja ik hou hiermee op, want ik kom geen stap verder en heb ik ook niet echt speciaal ergens voor nodig.
0
Berichten
10.421
Reputatie
4
Punten
0,00
Lid sinds
Laatst gezien
Hoezo kom je geen stap verder? Ik geef toch tips wat je fout doet?
Je zit al aardig op de goede weg, als je het in mijn vorige code toepast waar ik net naar linkte.
0
Desire

Lid · Topicstarter

Berichten
4.367
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Aarclay schreef:
Hoezo kom je geen stap verder? Ik geef toch tips wat je fout doet?
Je zit al aardig op de goede weg, als je het in mijn vorige code toepast waar ik net naar linkte.
Ja maar kijk.. Ik heb nog projecten liggen die af meten, en dit is niet echt noodzaklijk, dus kan ik hier nu beter eerst mee ophouden en later mee verder gaan..
0
Berichten
10.421
Reputatie
4
Punten
0,00
Lid sinds
Laatst gezien
Als je dit niet weet, dan mis je in mijn ogen wel wat kennis van PHP. Ik weet niet wat je andere projecten zijn, maar als dat ook PHP is, wens ik je veel succes.
0
Desire

Lid · Topicstarter

Berichten
4.367
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Aarclay schreef:
Als je dit niet weet, dan mis je in mijn ogen wel wat kennis van PHP. Ik weet niet wat je andere projecten zijn, maar als dat ook PHP is, wens ik je veel succes.
Nee dat is geen php yummie
En ja ik weet bijna niks van PHP.
0

Jouw reactie

Deel je idee, stel een vraag of help een ander verder.

Editor laden…

Praat mee met de One2xs-community.

Inloggen om te reageren