PHP Classes

File: vendor/eftec/bladeone/

Recommend this page to a friend!
  Classes of Jorge Castro  >  PHP PDO Login System One  >  vendor/eftec/bladeone/  >  Download  
File: vendor/eftec/bladeone/
Role: Auxiliary data
Content type: text/markdown
Description: Auxiliary data
Class: PHP PDO Login System One
Authenticate users with records on MySQL using PDO
Author: By
Last change:
Date: 2 years ago
Size: 2,112 bytes


Class file image Download

BladeOneLang extension library (optional)

Requires: BladeOne

This library adds cache to the visual layer and business/logic layer. For using this library, the code requires to include and use the trait BladeOneCache


class MyBlade extends  bladeone\BladeOne {
    use bladeone\BladeOneLang;
$blade=new MyBlade($views,$compiledFolder);

$blade->missingLog='c:\temp\missingkey.txt'; // (optional) if a traduction is missing the it will be saved here.

$lang='jp'; // try es,jp or fr
include './lang/'.$lang.'.php';

Where /lang/es.php is simmilar to:


use eftec\bladeone\BladeOneLang;

    ,'%s is a nice cat'=>'%s es un buen gato'

Template file

Hat in spanish is @_e('Hat')<br>
There is one @_n('Cat','Cats',1)<br>
@_ef('%s is a nice cat','Cheshire')<br>

Returns: Hat in spanish is Sombrero There is one Gato Cheshire es un buen gato.

  • Where MyBlade is a new class that extends the bladeone class and use the Lang features.

Template methods

@_e('Word or phrase')

it tries to translate the word if its in the array defined by BladeOneLang::$dictionary. If there is not a entry with the word 'Hat' (case sensitive) then it returns 'Hat'. Also, if the log file is define, the it also saves an entry with the missing word.

For the previous example. @_e('Hat') returns Sombrero.

@_ef('some phrase %s another words %s %i','word1','word2',20)

Its the same than @_e, however it parses the text (using sprintf). If the operation fails then, it returns the original expression without translation.

For the previous example.@_ef('%s is a nice cat','Cheshire') returns Cheshire es un buen gato.


If number is plural (more than 1) then it translates (if any) the second word, otherwise it translates the first word. If not number is used then it always translates the singular expression.

For the previous example.@_n('Cat','Cats',100) returns Cheshire es un buen gato.

For more information send a message to info at phpclasses dot org.