PHP Classes

File: index.php

Recommend this page to a friend!
  Classes of Payam Khaninejad   Simple Language Changer   index.php   Download  
File: index.php
Role: Example script
Content type: text/plain
Description: index page
Class: Simple Language Changer
Load localization strings based on current idiom
Author: By
Last change:
Date: 13 years ago
Size: 1,382 bytes
 

Contents

Class file image Download
<?php
/*
Description: Simple Language Changer Class
                you can use it for change language to another one
                it is simple to use
Auther: Payam khaninajad
Contact Email: progvig@yahoo.com
Site: http://progvig.ir
Year: 2010/11/13
*/
session_start();
// register session to change language
session_register("mylang");
// if session isn't set
if(!isset($_SESSION['mylang']))
{
   
$_SESSION['mylang']="en";
}
//include language class
require_once 'inc/lang.class.php';
$mylang=new mylanguage();
$mylang->load_language($_SESSION['mylang']);
// echo simple title
echo PROGVIGADS_Welcome."<br/>";
echo
PROGVIGADS_my_location.PROGVIGADS_location."<br/>";
echo
PROGVIGADS_Class_version.PROGVIGADS_Version;
///////or you can do it with site setting or user profile load it with mysql and change site language
// like $mylang->load_language("fa");
// or another way


if(isset($_GET['lang']))
{
    switch(
$_GET['lang'])
    {
        case
"ir":
       
$_SESSION['mylang']="fa";
        break;
        case
"en":
       
$_SESSION['mylang']="en";
        break;
        case
"tr":
       
$_SESSION['mylang']="tr";
        break;
    }
}

?>
<br />
<br />

<a href="index.php?lang=en"><img src="images/us.gif" /></a> | <a href="index.php?lang=ir"><img src="images/ir.gif" /> </a>|<a href="index.php?lang=tr"> <img src="images/tr.gif" /></a><br />
<a href="http://progvig.ir">Progvig.ir</a>