[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4688: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4690: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4691: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4692: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
Webmasterplein.net • Toon onderwerp - [PHP] Pagina's in pagina
aan alle goede dingen komt een eind, webmasterplein.net 2003 - 2013
wij danken jullie voor al mooie momenten die dankzij dit forum ontstonden - Derk, Rutger en Stef

[PHP] Pagina's in pagina

Je komt er niet helemaal uit bij het scripten? Übergoede functie geschreven? Alles met betrekking tot scripting, kun je hier terecht.

[PHP] Pagina's in pagina

Berichtdoor Wout » 19 maart 2005 14:33

Avatar gebruiker
Wout
wmpr
 
Berichten: 45
Geregistreerd: 19 maart 2005 13:53
Woonplaats: Eindhoven

Berichtdoor Anthony » 19 maart 2005 15:09

Wel Wout, eigenlijk is dat niet zó overdreven moeilijk.

Je hebt volgend script
[syntax="php"] <?
if(!$_GET['p'])
$_GET['p'] = "pagina_1";
if(file_exists('pagina/'.$_GET['p'].'.php'))
include('pagina/'.$_GET['p'].'.php');
else
echo"Whoops! Een 404 error.";
?>[/syntax](Sorry voor de uitlijning, het komt uit mijn pagina's)

Je ziet daar staan $_GET['p'], hij zal dus gaan zoeken in je url naar hetgeen achter ?p= staat. Je kan dit aanpassen maar let op, dan moet je dit ook 4 keer aanpassen in het script.

Verder is er een veiligheid ingebouwt, zodat hij zeker is dat de pagina bestaat. Dit staat hier if(file_exists($_GET['p'].'.php'))

De pagina's zitten bij mijn voorbeeld in de map pagina/, het zijn bestanden die eindigen op .php

Als ik dus intyp in mijn url tralala.php?p=voorbeeld zal hij in de map pagina kijken of die pagina bestaat en zoja zal hij hem includen.
Als dit niet bestaat dan zal hij zeggen Whoops! Een 404 error.

Dan is er nog 1 iets, als je niets invult achter de ?p= zal hij standaard pagina_1.php nemen.

Gesnapt, gesnopen? Smile
Laatst bijgewerkt door Anthony op 01 jan 1970 01:00, in totaal 2 keer bewerkt.
Avatar gebruiker
Anthony
wmpr
 
Berichten: 2828
Geregistreerd: 07 aug 2004 14:05
Woonplaats: Brugge - België

Berichtdoor Wout » 19 maart 2005 16:19

Avatar gebruiker
Wout
wmpr
 
Berichten: 45
Geregistreerd: 19 maart 2005 13:53
Woonplaats: Eindhoven

Berichtdoor Anthony » 19 maart 2005 16:21

Je smijt gewoon al die pagina's in je map Smile

Of bedoel je dat je meerdere keren dat script wilt maar voor verschillende dingen?

Zoals ?p=pagina_01&q=overmezelf

Dan maak je dat script gewoon 2 keer maar verander je de $_GET['.....']
Avatar gebruiker
Anthony
wmpr
 
Berichten: 2828
Geregistreerd: 07 aug 2004 14:05
Woonplaats: Brugge - België

Berichtdoor Wout » 19 maart 2005 16:22

Ik heb nu dit:[syntax="php"]<?

if(!$_GET['p'])
$_GET['p'] = "templates";
if(file_exists('pages/'.$_GET['p'].'.php'))
include('pages/'.$_GET['p'].'.php');
else
echo"Whoops! Een 404 error.";

if(!$_GET['p'])
$_GET['p'] = "links";
if(file_exists('pages/'.$_GET['p'].'.php'))
include('pages/'.$_GET['p'].'.php');
else
echo"Whoops! Een 404 error.";

?>[/syntax]
Alleen nu krijg de pages onder elkaar... Confused

[mod="Poly"]PHP tags[/mod]
Avatar gebruiker
Wout
wmpr
 
Berichten: 45
Geregistreerd: 19 maart 2005 13:53
Woonplaats: Eindhoven

Berichtdoor Anthony » 19 maart 2005 16:24

Je mag het ook op meerdere plaatsen zetten in je pagina hé.

Op de ene plaats zet je dit (bijvoorbeeld in je linkerkolom)
[syntax="php"]<?

if(!$_GET['p'])
$_GET['p'] = "templates";
if(file_exists('pages/'.$_GET['p'].'.php'))
include('pages/'.$_GET['p'].'.php');
else
echo"Whoops! Een 404 error.";
?>
[/syntax]
En op de andere plaats zet je dit (in je rechterkolom bijvoorbeeld)
[syntax="php"]<?

if(!$_GET['p'])
$_GET['p'] = "links";
if(file_exists('pages/'.$_GET['p'].'.php'))
include('pages/'.$_GET['p'].'.php');
else
echo"Whoops! Een 404 error.";

?>[/syntax]

Oja, ik raad aan om voor beide delen een aparte map te maken
Dus een map voor de templates en een map voor de links
Laatst bijgewerkt door Anthony op 01 jan 1970 01:00, in totaal 2 keer bewerkt.
Avatar gebruiker
Anthony
wmpr
 
Berichten: 2828
Geregistreerd: 07 aug 2004 14:05
Woonplaats: Brugge - België

Berichtdoor Wout » 19 maart 2005 16:28

Avatar gebruiker
Wout
wmpr
 
Berichten: 45
Geregistreerd: 19 maart 2005 13:53
Woonplaats: Eindhoven

Berichtdoor Anthony » 19 maart 2005 16:41

Avatar gebruiker
Anthony
wmpr
 
Berichten: 2828
Geregistreerd: 07 aug 2004 14:05
Woonplaats: Brugge - België

Berichtdoor KillerSponge » 19 maart 2005 17:30

Blabla en andere onzin - http://killersponge.nl
Avatar gebruiker
KillerSponge
Beheerder
Beheerder
 
Berichten: 14456
Geregistreerd: 24 aug 2004 13:05

Berichtdoor Anthony » 19 maart 2005 18:06

Avatar gebruiker
Anthony
wmpr
 
Berichten: 2828
Geregistreerd: 07 aug 2004 14:05
Woonplaats: Brugge - België

Berichtdoor KillerSponge » 19 maart 2005 18:07

Blabla en andere onzin - http://killersponge.nl
Avatar gebruiker
KillerSponge
Beheerder
Beheerder
 
Berichten: 14456
Geregistreerd: 24 aug 2004 13:05

Berichtdoor Wout » 19 maart 2005 20:22

Avatar gebruiker
Wout
wmpr
 
Berichten: 45
Geregistreerd: 19 maart 2005 13:53
Woonplaats: Eindhoven

Berichtdoor Anthony » 19 maart 2005 20:23

Avatar gebruiker
Anthony
wmpr
 
Berichten: 2828
Geregistreerd: 07 aug 2004 14:05
Woonplaats: Brugge - België

Berichtdoor Wout » 19 maart 2005 20:26

Avatar gebruiker
Wout
wmpr
 
Berichten: 45
Geregistreerd: 19 maart 2005 13:53
Woonplaats: Eindhoven

Berichtdoor Anthony » 19 maart 2005 20:29

Hier werkt de faq zo, dit is het script
[syntax="php"] <?
if(!$_GET['mode'])
$_GET['mode'] = "phpbbregels";
if(file_exists('pagina/'.$_GET['mode'].'.php'))
include('pagina/'.$_GET['mode'].'.php');
else
include('pagina/phpbbregels.php');
?>[/syntax]
Als je bovenaan klikt op Regels dan is de link faq.php?mode=regels
Dan haalt hij de pagina regels.php uit de map.
Anders haalt hij er de pagina phpbbregels.php uit.
Laatst bijgewerkt door Anthony op 01 jan 1970 01:00, in totaal 2 keer bewerkt.
Avatar gebruiker
Anthony
wmpr
 
Berichten: 2828
Geregistreerd: 07 aug 2004 14:05
Woonplaats: Brugge - België

Berichtdoor klaas » 19 maart 2005 20:58

klaas
wmpr
 
Berichten: 95
Geregistreerd: 06 feb 2005 01:08
Woonplaats: Nijmegen

Berichtdoor Derk » 19 maart 2005 21:20

Luister,
als jij zorgt dat jou links kloppen gaat er niks mis.
Pas sodra mensen gaan zitten kloten enzo krijg je errors.
Wat wel erg is is dat dat van rutger erg makkelijk te hacken is.
Ik doe het zo:

$pagina=$_GET['pagina'];

if ($pagina=="") { include("news.php"); }
if ($pagina=="home") { include("news.php"); }
else if ($pagina=="homel") { include("news.php"); }
else if ($pagina=="homel") { include("news.php"); }
else if ($pagina=="homel") { include("news.php"); }

enz....
Afbeelding
Avatar gebruiker
Derk
Beheerder
Beheerder
 
Berichten: 12634
Geregistreerd: 27 nov 2003 19:50
Woonplaats: Houten

Berichtdoor KillerSponge » 19 maart 2005 21:22

Blabla en andere onzin - http://killersponge.nl
Avatar gebruiker
KillerSponge
Beheerder
Beheerder
 
Berichten: 14456
Geregistreerd: 24 aug 2004 13:05


Keer terug naar PHP, ASP, SQL



cron