![BigKev73](https://xoops.org/uploads/savt3db7af60bd03e.gif)
This event is triggered when a new XoopsTpl (an extended Smarty object) is created. This allows customization of the Smarty environment from within a module.
Event is triggered when the establishment, or re-establishment, of the current user is complete.
At this point valid security decisions can be made based on the state of the current user.
This event is triggered when a new XoopsTpl (an extended Smarty object) is created. This allows customization of the Smarty environment from within a module.
One possible use would be to support a module based plugin library. An simplified example event listener:public static function eventCoreClassTemplateNew($arg)
{
$smartyObject = $arg[0];
$smartyObject->plugins_dir[] = __DIR__;
}
function smarty_function_translate($params, $smarty)
{
function smarty_function_translate($params, $smarty)
{
$key = isset($params['key']) ? $params['key'] : '';
$dirname = isset($params['dir']) ? $params['dir'] : ''; //Mtools
$utility = '\Xoopsmodules\' . ucfirst($dirname) . '\Utility';
return $utility::translate($key, $dirname);
}
}
<table cellspacing="0">
<tr id="header">
<td id="headerlogo"><a href="<{xoAppUrl /}>" title="<{$xoops_sitename}>"><{php}>
//This is used to calculate the various holidays and change the main Banner Logo Appropriately
$currentYear = date("Y");
$day = date("j");
$mnth = date("n");
//Used to Calculate floating Holidays
$easterday = date("j", easter_date($currentYear));
$eastermnth = date("n", easter_date($currentYear));
$edaystart = ($easterday - 7);
$edaystop = ($easterday + 2);
if ($edaystart<1 ) {$edaystart = 1;}
if ($edaystop>31 ) {$edaystop = 31;}
$turkeyDay = date('j', strtotime("november $currentYear fourth thursday"));
$turkeyStart = ($turkeyDay - 7);
$turkeyStop = ($turkeyDay + 2);
//Normal Image
$HolidayMsg = "Hello";
$logofile = $this->_tpl_vars['xoops_imageurl']. "logo_normal.jpg";
//XMAS
if ($mnth == "12" AND $day <= 29){
$logofile = $this->_tpl_vars['xoops_imageurl']. "logo_xmas.jpg";
$HolidayMsg = "Merry Christmas";
}else if ($mnth == "11" AND $day > $turkeyStop ) {
$logofile = $this->_tpl_vars['xoops_imageurl']. "logo_xmas.jpg";
$HolidayMsg = "Merry Christmas";
//NYE
}else if ($mnth == "12" AND $day > 29) {
$logofile = $this->_tpl_vars['xoops_imageurl']. "logo_newyears.jpg";
$HolidayMsg = "Happy New Years";
}else if ($mnth == "1" AND $day < 7) {
$logofile = $this->_tpl_vars['xoops_imageurl']. "logo_newyears.jpg";
$HolidayMsg = "Happy New Years";
//St Pattys Day
}else if ($mnth == "3" AND $day > 10 AND $day <= 19){
$logofile = $this->_tpl_vars['xoops_imageurl']. "logo_stpattys.jpg";
$HolidayMsg = "Happy St. Patty's Day";
//Easter
}else if ($mnth == $eastermnth AND $day >= $edaystart and $day <= $edaystop){
$logofile = $this->_tpl_vars['xoops_imageurl']. "logo_easter.jpg";
$HolidayMsg = "Happy Easter";
//4th July
}else if ($mnth == "6" AND $day >= 28){
$logofile = $this->_tpl_vars['xoops_imageurl']. "logo_4thjuly.jpg";
$HolidayMsg = "Happy 4th of July";
}else if ($mnth == "7" AND $day <= 6){
$logofile = $this->_tpl_vars['xoops_imageurl']. "logo_4thjuly.jpg";
$HolidayMsg = "Happy 4th of July";
//THANKSGIVING
}else if ($mnth == "11" AND $day >= $$turkeyStart AND $day <= $turkeyStop ) {
$logofile = $this->_tpl_vars['xoops_imageurl']. "logo_turkey.jpg";
$HolidayMsg = "Happy Thanksgiving";
//Default Normal Logo
}else{
$logofile = $this->_tpl_vars['xoops_imageurl']. "logo_normal.jpg";
}
echo '
. $logofile . '"';
<{/php}> alt="<{$xoops_sitename}>"/>a>td>
<td id="headerbanner"><{$xoops_banner}>td>
tr>
<tr>
<td id="headerbar" colspan="2" height="25" style="vertical-align: middle;"><FONT COLOR = #0066FF> <{if $xoops_isuser}> <{php}>echo $HolidayMsg;<{/php}> <{$xoops_name}> and Welcome Back! <{else}> <{php}>echo $HolidayMsg;<{/php}>! If you're new here, please register for a free account <{/if}>
tr>
table>