Multilanguage site with php


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. <!-- Included files contain, variable with their values -->
  2. <!-- Example url: index.php?lang=en -->
  3. <?php
  4. if (!isset ($_GET['lang'])) {
  5. if(isset($_SESSION['lang'])){
  6. $lang=$_SESSION['lang'];
  7. }
  8. else {
  9. $lang='bg';
  10. }
  11. } else {
  12. $lang = $_GET['lang'];
  13. }
  14. if ($lang=='bg') {
  15. $_SESSION['lang'] = 'bg';
  16. require('bg.php');
  17. } else {
  18. $_SESSION['lang'] = 'en';
  19. require('en.php');
  20. }
  21. $_SESSION['lang']=$lang;
  22.  
  23. echo "$home";
  24. ?>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.