Skip to content
This repository was archived by the owner on Jan 23, 2020. It is now read-only.

Latest commit

 

History

History
42 lines (32 loc) · 1.54 KB

File metadata and controls

42 lines (32 loc) · 1.54 KB

$Text - is system object, that provides interface for working with multilingual texts. Instance can be obtained in such way:

<?php
$Text = \cs\Text::instance();
###[Up](#) Methods

$Text object has next public methods:

  • get()
  • set()
  • del()
  • process()

Each method accepts database id as first parameter. This database should contain tables [prefix]text and [prefix]text_data with actual structure in order to work properly (primary database already have these tables).

Group - usually module name, or module name plus some section. Label - usually id of some item or section + id. Such structure is made for simpler managing of texts.

Get text by id. In most cases it is not needed because of $Text->process() method.

set($database : int, $group : string, $label : string, $text : string) : false|string

Set text for specified group and label.

del($database : int, $group : string, $label : string) : bool

Delete text for specified group and label.

process($database : int, $data : string|string[], $store_in_cache = false : bool) : false|string|string[]

Process text, and replace {¶([0-9]+)} on real text, is used before showing multilingual information.

Example how it works:

<?php
$Text = \cs\Text::instance();
//Set text by group and label
$result = $Text->set($this->cdb(), 'Blogs/sections/title', $id, $text);
//Process text
$content = $Text->process($this->cdb(), $result);