|
Posted by Steve on 10/11/06 21:05
your architecture is all wrong. separate the language from the html as much
as possible. either store a page's content in a db or in it's own file for
each language you intend to support...or keep each language in its own
directory and redirect to that directory as a virtual server. you cannot
hope to be able to maintain one page of code showing all language versions
between switch statements.
look for 'programming i18n' on google to shorten the learning curve.
hope that helps.
"Frits van Leeuwen" <fleeuwen@wanadoo.nlx> wrote in message
news:452d5699$0$45649$dbd4f001@news.wanadoo.nl...
| 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)
|
| But index.php has too match text I think.
| In the following code, I show you "**** English text ****" and "****Dutch
| text ****" thise are all the same texts. The difrence is the language. But
| when you look to the code, You will see 3 times Enlis text and 3 times
Dutch
| text. I think it has to be one time for both of them.
|
| This is index.php
|
| <?php
| if (isset($_COOKIE["LeeuwendeelTaal"]))
| {
| switch ($_COOKIE["LeeuwendeelTaal"])
| {
| case "EN": // ENGLISH
| ?>
| <html>
| <head>
| <title>Begin Leeuwendeel.info</title>
| </head>
| <body link="#0000FF" vlink="#800080" alink="#00FFFF" text="#FF0000"
| bgcolor="#FFFFE1">
| <div align="center">
| <table border="1" width="100%" id="table1" style="border-width: 0px"
| height="530">
| <tr>
| <td style="border-style: none; border-width: medium">
| **** English text ****
| </td>
| <td rowspan="1" style="border-style: none; border-width: medium">
| <p align="right"><img border="0" src="images/underconstruction.gif"
| width="480" height="379"></p>
| </td>
| <td style="border-style: none; border-width: medium">
| <!--vlag NL-->
| <p align="right"><a href="/language.php?ln=NL"><img border="0"
| src="knoppen/vlagNL.jpg" width="33" height="20" alt="Klik hier, wanneer u
de
| site in het Nederlands wilt lezen."></a></p>
| <!--vlag EN-->
| <p align="right"><a href="/language.php?ln=EN"><img border="2"
| src="knoppen/vlagEN.jpg" width="33" height="20" alt="Click here, when you
| like to read the website in English."></a></p>
| </td>
| </tr>
| </table>
| </div>
| <p align="center"><font size="1">Last change:
|
| <?php
| break; // einde ENGLISH
|
| case "NL": // NEDERLANDS
| ?>
| <html>
| <head>
| <title>Begin Leeuwendeel.info</title>
| </head>
| <body link="#0000FF" vlink="#800080" alink="#00FFFF" text="#FF0000"
| bgcolor="#FFFFE1">
| <div align="center">
| <table border="1" width="100%" id="table1" style="border-width: 0px"
| height="530">
| <tr>
| <td style="border-style: none; border-width: medium">
| **** Dutch text **** </td>
| <td rowspan="1" style="border-style: none; border-width: medium">
| <p align="right"><img border="0" src="images/underconstruction.gif"
| width="480" height="379"></p>
| </td>
| <td style="border-style: none; border-width: medium">
| <!--vlag NL-->
| <p align="right"><a href="/language.php?ln=NL"><img border="2"
| src="knoppen/vlagNL.jpg" width="33" height="20" alt="Klik hier, wanneer u
de
| site in het Nederlands wilt lezen."></a></p>
| <!--vlag EN-->
| <p align="right"><a href="/language.php?ln=EN"><img border="0"
| src="knoppen/vlagEN.jpg" width="33" height="20" alt="Click here, when you
| like to read the website in English."></a></p>
| </td>
| </tr>
| </table>
| </div>
| <p align="center"><font size="1">Laatste wijziging:
|
| <?php
| break;
|
| default:
| ?>
| <html>
| <head>
| <title>Begin Leeuwendeel.info</title>
| </head>
| <body link="#0000FF" vlink="#800080" alink="#00FFFF" text="#FF0000"
| bgcolor="#FFFFE1">
| <div align="center">
| <table border="1" width="100%" id="table1" style="border-width: 0px"
| height="530">
| <tr>
| <td style="border-style: none; border-width: medium">
| **** Dutch text ****
| </td>
| <td rowspan="1" style="border-style: none; border-width: medium">
| <p align="center"><img border="0" src="images/underconstruction.gif"
| width="480" height="379"></p>
| </td>
| <td style="border-style: none; border-width: medium">
| **** English text ****
| </td>
| </tr>
| <tr>
| <td style="border-style: none; border-width: medium">
| <p align="center"><a href="/language.php?ln=NL"><img border="0"
| src="knoppen/vlagNL.jpg" width="165" height="100" alt="Klik hier, wanneer
u
| de site in het Nederlands wilt lezen."></a>
| </td>
| <td style="border-style: none; border-width: medium">
| </td>
| <td style="border-style: none; border-width: medium">
| <p align="center"><a href="/language.php?ln=EN"><img border="0"
| src="knoppen/vlagEN.jpg" width="165" height="100" alt="Click here, when
you
| like to read the website in English."></a>
| </td>
| </tr>
| </table>
| </div>
| <p align="center"><font size="1">Laatste wijziging / Last change:
|
| <?php
| break; // einde geen keuze
|
| }
| }
|
| else
| {
| setcookie("LeeuwendeelTaal");
| ?>
| <html>
| <head>
| <title>Begin Leeuwendeel.info</title>
| </head>
| <body link="#0000FF" vlink="#800080" alink="#00FFFF" text="#FF0000"
| bgcolor="#FFFFE1">
| <div align="center">
| <table border="1" width="100%" id="table1" style="border-width: 0px"
| height="530">
| <tr>
| <td style="border-style: none; border-width: medium">
| **** Dutch text ****
| </td>
| <td rowspan="1" style="border-style: none; border-width: medium">
| <p align="center"><img border="0" src="images/underconstruction.gif"
| width="480" height="379"></p>
| </td>
| <td style="border-style: none; border-width: medium">
| **** English text ****
| </td>
| </tr>
| <tr>
| <td style="border-style: none; border-width: medium">
| <p align="center"><a href="/language.php?ln=NL"><img border="0"
| src="knoppen/vlagNL.jpg" width="165" height="100" alt="Klik hier, wanneer
u
| de site in het Nederlands wilt lezen."></a>
| </td>
| <td style="border-style: none; border-width: medium">
| </td>
| <td style="border-style: none; border-width: medium">
| <p align="center"><a href="/language.php?ln=EN"><img border="0"
| src="knoppen/vlagEN.jpg" width="165" height="100" alt="Click here, when
you
| like to read the website in English."></a>
| </td>
| </tr>
| </table>
| </div>
| <p align="center"><font size="1">Laatste wijziging / Last change:
| <?php
| }
| ?>
|
| <!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d-%m-%Y"
| startspan -->11-10-2006<!--webbot bot="Timestamp" i-checksum="12558"
| endspan --></font></p>
| </body>
| </html>
|
| --------------------------------------------------------------------------------
| Mijn Postvak In wordt beschermd door SPAMfighter
| 4017 spam-mails zijn er tot op heden geblokkeerd.
| Download de gratis SPAMfighter vandaag nog!
|
|
[Back to original message]
|