Hello World!
First, create a file named hello_world.view.php
and put it in {system}/core/front_end/actions/view/_home/
.
<?php
namespace actions;
use libraries\fxr_lib as Fxr_lib;
use libraries\add as Add;
if (!defined('FXR_INDEX')) {
header('HTTP/1.1 403 Forbidden');
exit('No direct script access allowed');
}
//======================================================================
// Hello World
//======================================================================
$tags_view['hello_world'] = function()
{
$action_tag = 'hello_world';
$content = '';
if (defined("AUTH_ACCESS_FRT") && (AUTH_ACCESS_FRT != 0)) {
//-----------------------------------------------------
// public access
//-----------------------------------------------------
} else {
$action_lang = THEME_LANG_FRT;
$action_folder = THEME_FOLDER_FRT;
$action_tpl = '_home_page'; // change it if needed
$cache_active = 1;
if ((defined("THEME_LANG_FRT") && isset($action_lang))
&& (defined("THEME_FOLDER_FRT") && isset($action_folder))
&& (defined("TPL_FRT") && isset($action_tpl))) {
if ((THEME_LANG_FRT == $action_lang || $action_lang == '_all')
&& (THEME_FOLDER_FRT == $action_folder || $action_folder == '_all')
&& (TPL_FRT == $action_tpl || $action_tpl == '_all')) {
$content .= 'Hello World!';
/*
* cache
*/
if (defined('UPDATE_CACHE_TAGS_OUTPUTS_FRT')
&& UPDATE_CACHE_TAGS_OUTPUTS_FRT === 1) {
Fxr_lib\Cache::updateCacheTagsOutputs(
$action_tag, $content, $cache_active);
}
return $content;
} else {
return '{' . $action_tag . '}';
}
} else {
return '{' . $action_tag . '}';
}
}
};
Then, add a line in {system}/config/front_end/actions/view/config_view_frt.php
:
$view_files = array(
[...]
'hello_world.view' => '_home'
);
Finally, open the home tpl file in themes/front_end/{theme_lang}/{theme_folder}/{html}/public/tpl/{default_home_page}
and add {hello_world}
tag:
<!-- default: ../en-us/theme_default_frt/../'_home_page' -->
<html>
<body>
{hello_world}
</body>
</html>