PHP Classes

File: examples/language.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in Bookmark in
  Classes of philippe thomassigny  >  DomCore  >  examples/language.php  >  Download  
File: examples/language.php
Role: Example script
Content type: text/plain
Description: Example script
Class: DomCore
Base library for PHP Web applications
Author: By
Last change: patch 3.0.0
Date: 14 days ago
Size: 1,971 bytes


Class file image Download
// have to put this into a php block or the <?xml will be put as a PHP syntax error on extended code escape
echo '<?xml version="1.0" encoding="UTF-8"?>';
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">

<html xmlns="" xml:lang="en" lang="en">
  <!-- Generic browser family -->
  <title>DomCore Demos, a WebAbility&reg; Network Project</title>
  <meta http-equiv="PRAGMA" content="NO-CACHE" />
  <meta http-equiv="Expires" content="-1" />

  <meta name="Keywords" content="WAJAF, WebAbility" />
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  <meta name="Charset" content="UTF-8" />
  <meta name="Language" content="en" />
  <link rel="stylesheet" href="/skins/css/domcore.css" type="text/css" />


<div class="container">

<a href="../index.html" class="back">&#xAB; Back to the index</a><br />
<br />

<h1>\core\WALanguage example</h1>


// We assure any DomCore library we call will be automatically loaded
include_once '../include/__autoload.lib';

define ('WADEBUG', false);
setlocale(LC_ALL, 'es_MX.UTF8', 'es_MX', '');

$table = <<<EOF
<?xml version="1.0" encoding="UTF-8" ?>
<language id="daysofweek" lang="es">

<entry id="sunday"><![CDATA[Domingo]]></entry>
<entry id="monday"><![CDATA[Lunes]]></entry>
<entry id="tuesday"><![CDATA[Martes]]></entry>
<entry id="wednesday"><![CDATA[Miércoles]]></entry>
<entry id="thursday"><![CDATA[Jueves]]></entry>
<entry id="friday"><![CDATA[Viernes]]></entry>
<entry id="saturday"><![CDATA[Sábado]]></entry>


$lang = new \core\WALanguage($table);

// print day in spanish/mexico
print "Hoy es ".$lang->getEntry(strtolower(date("l", time()))) . "<br />";


<br />
<br />
<br />
<br />

<a href="../index.html" class="back">&#xAB; Back to the index</a><br />