PHP Classes

File: example.php

Recommend this page to a friend!
  Classes of Stanescu Mihai   Language System   example.php   Download  
File: example.php
Role: Example script
Content type: text/plain
Description: Just an example of how to use the class
Class: Language System
Let the user choose the application idiom
Author: By
Last change:
Date: 13 years ago
Size: 1,080 bytes
 

Contents

Class file image Download
<?php
// Include the class
include 'language.class.php';

// Include config file
include 'config.php';

// Call the language instance
$language = new language(DefaultLang);

// Check if the language it's saved in cookies else try to load the default language
$loadlang = $language->check();

// Load the language
$language->load($loadlang);

// Print's constants of the curent language
?>
<html>
<head>
<title><?php echo Title;?></title>
<!DOCTYPE html
  PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script language="JavaScript">

function loadPage(list) {

  location.href="language.php?href=<?php echo $_SERVER['PHP_SELF'];?>&lang=" + list.options[list.selectedIndex].value

}

</script>
</head>
<body>
<?php echo Text;?>

<form>
<select name="lang" onchange="loadPage(this.form.elements[0])"
  target="_parent._top"
  onmouseclick="this.focus()"
  style="background-color:#ffffff">

<?php echo $language->language_options();?>
</select>
</form>

</body>
</html>