Fuel Parser Class
This class extends the Fuel_base_library class.
Properties Reference
Property | Default Value | Description |
---|---|---|
protected | ||
compile_dir | N/A | The directory to compile to |
compile_dir_perms | N/A | The compile directory permissions |
compile_file_perms | N/A | The compiled file permissions |
allowed_functions | N/A | Functions that are allowed by the parsing engine |
delimiters | N/A | The delimiters used for parsing |
refs | N/A | Object references that get passed to the parsing engine |
data | N/A | Variables that get passed to the parsing engine |
engine | N/A | The actual parsing engine object |
Function Reference [+]
$this->fuel->parser->initialize([$params=array()])
Initialize the object and set object parameters. Accepts an associative array as input, containing object preferences. Also will set the values in the parameters array as properties of this object.
Returns
void
Parameters
(array) $params Config preferences
$this->fuel->parser->set_engine(['$engine'=NULL], [$config=array()])
Sets parsing engine.
Returns
object A reference to the Fuel_parser object
Parameters
(mixed) $engine Can be a string (e.g. 'dwoo', 'twig', 'ci') or an object that implements the Fuel_parser_interface (string) $config Configuration parameters to pass to the parsing engine (e.g. compile_dir, delimiters, allowed_functions, refs, data)
$this->fuel->parser->get_engine()
Returns the parsing engine object.
Returns
object
$this->fuel->parser->name()
The parsing engine's name (e.g. dwoo, twig, ci).
Returns
string
$this->fuel->parser->set_compile_dir('$dir')
Sets the compiled directory path.
Returns
object A reference to the Fuel_parser object
Parameters
(string) $dir The directory path
$this->fuel->parser->get_compiled_dir()
Returns the compiled directory path.
Returns
string
$this->fuel->parser->set_delimiters('$delimiters', ['$type'=NULL])
Sets the delimiters for the parser.
Returns
string
Parameters
(string) $delimiters
$this->fuel->parser->get_delimiters(['$type'=NULL])
Gets the delimiter for the parser.
Returns
string
Parameters
(string) $type The type of delimiter
$this->fuel->parser->add_allowed_function('$func')
Adds an allowed function.
Returns
object A reference to the Fuel_parser object
Parameters
(string) $func The name of the function to remove
$this->fuel->parser->remove_allowed_function('$func')
Removes a function from the allowed list of functions.
Returns
object A reference to the Fuel_parser object
Parameters
(string) $func The name of the function to remove
$this->fuel->parser->add_data('$data', ['$value'=NULL])
Adds data to be passed to the parsing engine.
Returns
object A reference to the Fuel_parser object
Parameters
(mixed) $data Can be an array or a string (but if string must pass the second $value parameter) (mised) $value A value to associate with the $data (which is the $variable name... optional)
$this->fuel->parser->clear_data()
Removes the data passed to the parsing engine.
Returns
object A reference to the Fuel_parser object
$this->fuel->parser->parse('$view', [$data=array()], ['$return'=FALSE])
Parse a view file. Parses pseudo-variables contained in the specified template, replacing them with the data in the second param.
Returns
string
Parameters
(string) $view (array) $data (bool) $return
$this->fuel->parser->parse_string('$string', [$data=array()], ['$return'=TRUE])
Parses a string.
Returns
string
Parameters
(string) $string (array) $data (bool) $return
$this->fuel->parser->create_compile_dir()
Creates the compile dir if possible in case it doesn't exist.
Returns
bool
$this->fuel->parser->php_to_syntax('$str')
Converts PHP syntax to the templating syntax... as best it can without getting crazy.
Returns
string
Parameters
(string) $str