PHP Classes

File: example_lang.php

Recommend this page to a friend!
  Classes of Light God   lang   example_lang.php   Download  
File: example_lang.php
Role: Example script
Content type: text/plain
Description: test script, example of usage
Class: lang
Retrieve internationalization texts from INI files
Author: By
Last change:
Date: 17 years ago
Size: 1,123 bytes
 

Contents

Class file image Download
<?php
   
include "lang.class";

    if(empty(
$_GET['lang'])) $_GET['lang'] = "hu";
   
$lang = new Lang($_GET['lang']);
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//<?php echo strtoupper($lang->lang) ?>" "http://www.w3.org/TR/html4/loose.dtd">
<html>
    <head>
        <title><?php echo $lang->text['main_title'] ?></title>
        <meta http-equiv="Content-Type" content="text/html; charset=<?php echo $lang->text['data_charset'] ?>">
        <meta http-equiv="Content-Language" content="<?php echo $lang->lang ?>">
        <link rel="stylesheet" type="text/css" href="main.css">
    </head>
    <body>
<?
   
if(empty($_GET['menu'])) $_GET['menu'] = 0;
    echo
"<ul class='menu'>\n";
    for(
$i=0;$i<6;$i++) {
        echo
"<li".($_GET['menu'] == $i ? ' class="selected"' : '')."><a href=\"?menu=".$i."&amp;lang=".$lang->lang."\">".$lang->text['menu_menu'.$i]."</a></li>\n";
    }
    echo
"</ul>\n";
    echo
"<ul class='lang'>\n";
    foreach(
$lang->languages as $code => $name) {
        echo
"<li".($_GET['lang'] == $code ? ' class="selected"' : '')."><a href='?menu=".$_GET['menu']."&amp;lang=".$code."'>".$name."</a></li>\n";
    }

    echo
"</ul>\n";
?>
</body>
</html>