Lid |
|
Hey allen,
Op mijn website staat in mijn index.php file volgende stukje code:
<?php
session_start();
include 'core/header.php';
include 'province.php';
if ($_GET['p'] == ""){
$include = "home";
}
else {
$page = $_GET['p'];
if (file_exists("core/".$page.".php")==true) {
$include = $page;
}
else {
$include = "home";
}
}
include("core/".$include.".php");
include 'core/footer.php';
?>
<?php include 'core/header.php'; include 'province.php'; if ($_GET['p'] == ""){ $include = "home"; } else { $page = $_GET['p']; $include = $page; } else { $include = "home"; } } include("core/".$include.".php"); include 'core/footer.php'; ?>
In mijn header.php file gebruik ik nu volgende code:
<?php
include 'config.php';
$_GET['p'] = (isset($_GET['p']) ? $_GET['p'] : 'default');
if ($_GET['lang'] == $T5){ $TX = $T5; }
elseif ($_GET['lang'] == $T4){ $TX = $T4; }
elseif ($_GET['lang'] == $T3){ $TX = $T3; }
elseif ($_GET['lang'] == $T2){ $TX = $T2; }
else { $TX = $T1; }
if ($_GET['prov'] == $P8){ $_SESSION['PX'] = $P8; }
elseif ($_GET['prov'] == $P7){ $_SESSION['PX'] = $P7; }
elseif ($_GET['prov'] == $P6){ $_SESSION['PX'] = $P6; }
elseif ($_GET['prov'] == $P5){ $_SESSION['PX'] = $P5; }
elseif ($_GET['prov'] == $P4){ $_SESSION['PX'] = $P4; }
elseif ($_GET['prov'] == $P3){ $_SESSION['PX'] = $P3; }
elseif ($_GET['prov'] == $P2){ $_SESSION['PX'] = $P2; }
else { $_SESSION['PX'] = $P1; }
?>
<?php include 'config.php'; $_GET['p'] = (isset($_GET['p']) ? $_GET['p'] : 'default'); if ($_GET['lang'] == $T5){ $TX = $T5; } elseif ($_GET['lang'] == $T4){ $TX = $T4; } elseif ($_GET['lang'] == $T3){ $TX = $T3; } elseif ($_GET['lang'] == $T2){ $TX = $T2; } else { $TX = $T1; } if ($_GET['prov'] == $P8){ $_SESSION['PX'] = $P8; } elseif ($_GET['prov'] == $P7){ $_SESSION['PX'] = $P7; } elseif ($_GET['prov'] == $P6){ $_SESSION['PX'] = $P6; } elseif ($_GET['prov'] == $P5){ $_SESSION['PX'] = $P5; } elseif ($_GET['prov'] == $P4){ $_SESSION['PX'] = $P4; } elseif ($_GET['prov'] == $P3){ $_SESSION['PX'] = $P3; } elseif ($_GET['prov'] == $P2){ $_SESSION['PX'] = $P2; } else { $_SESSION['PX'] = $P1; } ?>
Als .htaccess gebruik ik het volgende om die clean URL weer te geven (dus ook mooi met die 'prov'):
RewriteRule ^(e-catalog)($|/) - [L]
RewriteRule ^update/([A-Za-z0-9-]+)/([A-Za-z0-9-]+)/?$ update/index.php?lang=$1&p=$2 [L]
RewriteRule ^update/?$ update/index.php [L]
RewriteRule ^([A-Za-z0-9-]+)/?$ index.php?lang=$1 [L]
RewriteRule ^([A-Za-z0-9-]+)/([A-Za-z0-9-]+)/?$ index.php?lang=$1&prov=2 [L]
RewriteRule ^([A-Za-z0-9-]+)/([A-Za-z0-9-]+)/([A-Za-z0-9-]+)/?$ index.php?lang=$1&prov=2&p=$3 [L]
RewriteRule ^([A-Za-z0-9-]+)/([A-Za-z0-9-]+)/([A-Za-z0-9-]+)/([A-Za-z0-9-]+)/?$ index.php?lang=$1&prov=2&p=$3&id=$4 [L]
RewriteRule ^(e-catalog)($|/) - [L] RewriteRule ^update/([A-Za-z0-9-]+)/([A-Za-z0-9-]+)/?$ update/index.php?lang=$1&p=$2 [L] RewriteRule ^update/?$ update/index.php [L] RewriteRule ^([A-Za-z0-9-]+)/?$ index.php?lang=$1 [L] RewriteRule ^([A-Za-z0-9-]+)/([A-Za-z0-9-]+)/?$ index.php?lang=$1&prov=2 [L] RewriteRule ^([A-Za-z0-9-]+)/([A-Za-z0-9-]+)/([A-Za-z0-9-]+)/?$ index.php?lang=$1&prov=2&p=$3 [L] RewriteRule ^([A-Za-z0-9-]+)/([A-Za-z0-9-]+)/([A-Za-z0-9-]+)/([A-Za-z0-9-]+)/?$ index.php?lang=$1&prov=2&p=$3&id=$4 [L]
Echter, op de pagina genaamd 'finalists' heb ik volgende code staan om te zien wat er nu eigenlijk wordt onthouden:
<?php echo $_SESSION['PX'] ?><br />
<?php echo ($_GET['prov']) ?>
<?php echo $_SESSION['PX'] ?><br /> <?php echo ($_GET['prov']) ?>
Wanneer ik de pagina online zou oproepen, zie ik daar staan:
national
2
Op het eerste zicht zou je denken dat hij die $_SESSION... goed onthoudt, maar als ik mijn hyperlink van .../en/national/finalists zou wijzigen naar .../en/antwerp/finalists, dan blijft hij gewoon dit tonen:
national
2
(dus neemt hij de juiste 'prov' niet over). En daarbij nog... Waarom neemt hij die '2' uit het .htaccess bestand neemt van waarde prov, en niet de effectieve waarde dewelke er staat?
Iemand enig idee...?
Alvast bedankt!
|