CS174
Chris Pollett
Nov. 13, 2013
<p style="direction:rtl; unicode-bidi: bidi-override; text-align: right" ><bdo dir="rtl" > This is a test.</bdo></p>would look like:
This is a test.
gettext("translate_me"); // you could also use _("translate_me");
putenv('LC_ALL=en_US');
setlocale(LC_ALL, 'en_US'); // say locale
bindtextdomain("myMoFile", "./locale"); // say locale dir
textdomain("myMoFile"); // say .mo file
_("translate_me"); // looks for ./locale/en_US/LC_MESSAGES/myMoFile.mo
// to find the translation.
xgettext -L PHP filename.php
#: filename.php:6 msgid "translate_me" msgstr ""
msgfmt -o myMoFile.mo myMoFile.po
<?php $blah++; ?>You should see a notice saying blah is undefined.
class Layout
{
var $view;
function __contruct($view)
{
$this->view = $view;
//contructor code
}
function render($data)
{
?>
<html>
<head><title><?php echo $data['title']; ?></title></head>
<body>
<?php $this->view->render($data); ?>
</body>
</html>
<?php
}
}
This avoids headaches such as sending HTTP headers from a sessions after some HTML has been output.
echo $my_assoc['my_field']; //not echo $my_assoc[my_field];