FUEL CMS User Guide : Version 0.9.3


FUEL helper

Contains FUEL specific functions. This helper actually exists in the fuel module and should be loaded the following way:

$this->load->module_helper(FUEL_FOLDER, 'fuel');

The following functions are available:

fuel_block(params)

Allows you to load a view and pass data to it. The params parameter can either be string value (in which case it will assume it is the name of the block view file) or an associative array that can have the following values:

fuel_model(module, [params])

Loads a module's model and creates a variable that you can use to merge data into your view. The params parameter is an associative array that can have the following values:

fuel_nav(params)

Creates a menu structure. The params parameter is an array of options to be used with the Menu class. If FUEL's configuration mode is set to either auto or cms, then it will first look for data from the FUEL navigation module. Otherwise it will by default look for the file views/_variables/nav.php (you can change the name of the file it looks for in the file parameter passed). That file should contain an array of menu information (see Menu class for more information on the required data structure). The parameter values are very similar to the Menu class, with a few additions shown below:

For more information see the Menu class.

fuel_set_var(key, val)

Sets a variable for all views to use no matter what view it is declared in.

fuel_var(key, [default], [edit_module], [evaluate])

Returns a variable and allows for a default value. Also creates inline editing marker. The default parameter will be used if the variable does not exist. The edit_module parameter specifies the module to include for inline editing. The evaluate parameter specifies whether to evaluate any php in the variables.

You should not use this function inside of another function because you may get unexepected results. This is because it returns inline editing markers that later get parsed out by FUEL. For example, you shouldn't do:

// NO
<a href="<?=site_url(fuel_var('my_url'))?>">my link</a>

Instead you should use fuel_edit() like so:

// YES
<?=fuel_edit('my_url', 'Edit Link')?> <a href="<?=site_url($my_url)?>">my link</a>

fuel_edit(id, [label], [module], [xOffset], [yOffset])

Sets a variable marker (pencil icon) in a page which can be used for inline editing. The id parameter is the unique id that will be used to query the module. You can also pass an id value and a field like so id|field. This will display only a certain field instead of the entire module form. The label parameter specifies the label to display next to the pencil icon. The xOffset and yOffset are pixel values to offset the pencil icon.

fuel_var_append(key, value)

Appends a value to an array variable. This function makes it convenient if you are in a view file and want to say add a javascript file to your $js array variable for example. The $js variable can then be passed to the asset helper's js($js) function with the appended values. The key value is the name of the array variable you want to append to. The value can be either an array or a string. An array will merge the values.

// EXAMPLE HEADER FILE
...
<meta name="keywords" content="<?php echo fuel_var('meta_keywords')?>" />
<meta name="description" content="<?php echo fuel_var('meta_description')?>" />

<?php echo css('main'); ?>
<?php echo css($css); ?>

<?php echo js('jquery, main'); ?>
<?php echo js($js); ?>
...


// Then in your view file
...
<php
fuel_var_append('css', 'my_css_file.css');
fuel_var_append('js', 'my_js_file.js');
?>

About our company

...

fuel_cache_id([location])

Creates the cache ID for the fuel page based on the URI. If no location value is passed, it will default to the current uri_path.

fuel_url([uri])

Creates the admin URL for FUEL (e.g. http://localhost/MY_PROJECT/fuel/admin).

fuel_uri([uri])

Returns the FUEL admin URI path.

fuel_uri_segment([seg_index], [rerouted])

Returns the uri segment based on the FUEL admin path.

fuel_uri_index([seg_index])

Returns the uri index number based on the FUEL admin path.

fuel_uri_string([from], [to], [rerouted])

Returns the uri string based on the FUEL admin path.

is_fuelified()

Check to see if you are logged in and can use inline editing. Is an alias to the Fuel_auth::is_fuelified().