Login   Register  
PHP Classes
elePHPant
Icontem

File: example.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of MC Breit  >  LanguageSys  >  example.php  >  Download  
File: example.php
Role: Example script
Content type: text/plain
Description: Example script (For use in a webenviroment)
Class: LanguageSys
Use multi-idiom texts with pre-compilation support
Author: By
Last change: Made some undocumented changes.
Date: 2005-01-08 14:30
Size: 1,560 bytes
 

Contents

Class file image Download
<html>
 <head>
  <title>LanguageSys Example</title>
  <style type="text/css">
   body {
         color:white;
         background:darkgray;
        }
   h1 {
        background:green;
        margin:10px;
      }
   #a {
        background:orange;
        margin:10px;
      }
   #b {
        color:black;
        background:yellow;
        margin:10px;
      }
   #c {
        color:black;
        background:skyblue;
        margin:10px;
      }
   #d {
        color:black;
        background:red;
        margin:10px;
      }
   #e {
        background:purple;
        margin:10px;
      }
   
  </style>
 </head>
 <body>
<?php

include('LanguageSys.class.php');

$lang = &new LanguageSys();

if( !isset(
$_REQUEST['lang']) )
{
  
$_REQUEST['lang'] = 'de-DE';
}

if( !
$lang->load($_REQUEST['lang']) )
{
  die(
$lang->last_error());
}

?>
  <h1><?=$lang->welcome?></h1>
  <div id="a">
   <?=$lang->select_a_language?><br />
   <form>
    <select name="lang">
     <?php
      $list 
$lang->get_aviable_languages(LSYS_RTN_MIXED);
      foreach(
$list as $code => $name)
      {
        print 
"<option value=\"$code\">$name</option>";
      }
     
?>
    </select>
    <input type="submit" value="<?=$lang->translate?>">
   </form>
   <?=sprintf($lang->some_exampels_at"/lang/");?>
  </div>
  <pre id="b"><?=$lang->foo?></pre>
  <pre id="c"><?=$lang->bar?></pre>
  <pre id="d"><?=$lang->faz?></pre>
  <pre id="e"><?=$lang->baz?></pre>
  <?=$lang->get_transinfo()?>
 </body>
</html>