Skip to content

Instantly share code, notes, and snippets.

@segellabs
Created March 7, 2010 05:46
Show Gist options
  • Save segellabs/324175 to your computer and use it in GitHub Desktop.
Save segellabs/324175 to your computer and use it in GitHub Desktop.
<?php
session_start();
if (isset($_GET['bahasa']) and !empty($_GET['bahasa'])) {
$_SESSION['bahasa'] = $_GET['bahasa'];
} else if (!isset($_SESSION['bahasa'])) {
$_SESSION['bahasa'] = 'id';
}
$file_bahasa = 'dir_bahasa/'.$_SESSION['bahasa'].'.php';
if (file_exists($file_bahasa)) {
include $file_bahasa;
}
function pilihan_bahasa()
{
echo '<ul>
<li><a href="?bahasa=id">Indonesia</a></li>
<li><a href="?bahasa=en">Inggris</a></li>
</ul>';
}
<?php
include 'bahasa.php';
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title><?php echo $judul ?></title>
</head>
<body>
<?php pilihan_bahasa()?>
<h1><?php echo $judul ?></h1>
<div><?php echo $isi ?></div>
</body>
</html>
<?php
$judul = 'This is title';
$isi = 'This is content';
<?php
$judul = 'Ini adalah judul';
$isi = 'Ini adalah isi';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment