espfutbol98
New Member
- Messages
- 200
- Reaction score
- 2
- Points
- 0
I have been translating my site by echoing variables that are in included files depending on a cookie. Example:
index.php
translation_hr.php
translation_en.php
But I have noticed, like with phBB, they use arrays for this. Are they better? If so, how are they done?
index.php
PHP:
<?php
if (isset($_COOKIE['lang']) && $_COOKIE['lang'] == "hr") {
include "translation_hr.php";
}
else {
include "translation_en.php";
}
?>
<html>
<head>
</head>
<body>
<p><?php echo $t_welcome; ?></p>
</body>
</html>
PHP:
<?php
$t_welcome = "Dobrodošli";
?>
PHP:
<?php
$t_welcome = "Welcome";
?>
Last edited: