|
Posted by .:[ ikciu ]:. on 10/18/06 00:34
Hmm Frits van Leeuwen <fleeuwen@wanadoo.nlx> wrote:
> Hello,
> I have index.php and language.php
> At index.php are buttons for choose language.
> In language I set a cookie and go back to index.php. (I'm happy, it's
> working)
i will try once more time
1. you have to separate style from you html code - don't listen to steve (he
is right, you can use both, but there is no sense - your code should be
clean)
2. cookies is not good idea as i wrote at the begining - some1 can turn off
this option - session is much better - works always
3. make clean layout for example
session_start();
$languages = array(
1 => 'en',
2 => 'nl',
3 => 'default'
}
if(!isset($_SESSION['ln'])){
$_SESSION['ln'] = $languages[3];
}
if(isset($_GET['ln']) && in_array($languages)){
$_SESSION['ln'] = $_GET['ln'];
}
unset($languages[array_search($_SESSION['ln'],$languages)]);
<html>
<head>
<title>Begin Leeuwendeel.info</title>
</head>
<body>
<div>
<table id="table1">
<tr>
foreach($languages as $lang){
if(isset($langData[$lang]['info'])) print "
<td>".$langData[$lang]['info']."</td>";
else print "<td>underconsturction</td>";
}
</tr>
<tr>
foreach($languages as $lang){
if(isset($langData[$lang][alt])) print ' <td><a
href="/language.php?ln='.$lang.'"><img src="knoppen/vlag'.$lang.'.jpg"
alt="'.$langData[$lang]['alt'].'"></a></td>';
else print "<td>underconsturction</td>";
}
</tr>
</table>
</div>
<p>Laatste wijziging / Last change:
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d-%m-%Y"
startspan -->11-10-2006<!--webbot bot="Timestamp" i-checksum="12558"
endspan --></p>
</body>
</html>
DONE
ofc you should to use template - there where is php you can set {info} {alt}
and later you can replace it with value, try to use classes if you can, make
requestMaper for handle PGC, make class for handle language and make printer
for show parsed php code into webbrower
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ikciu | gg: 718845 | yahoo: ikciu_irsa | www: www.e-irsa.pl
2be || !2be $this => mysql_query();
Navigation:
[Reply to this message]
|