diff --git a/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/helpers.php b/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/helpers.php index 2596d5c26..7675320a5 100644 --- a/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/helpers.php +++ b/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/helpers.php @@ -1,13 +1,28 @@ debugging = true; + $smarty -> caching = true; + $smarty -> cache_lifetime = 120; + if ( !helpers :: check_if_game_client () ){ + $smarty -> template_dir = $AMS_LIB . '/templates/'; + $smarty->setConfigDir($AMS_LIB .'/config'); + }else{ + $smarty -> template_dir = $NELTOOL_SITEBASE . '/templates/'; + $smarty->setConfigDir($NELTOOL_SITEBASE .'/config'); + } + $smarty -> assign( "option_selected", "NE" ); + $smarty -> display( $template . '.tpl' ); } - public function check_if_game_client() + public function check_if_game_client() { // if HTTP_USER_AGENT is not set then its ryzom core if ( !isset( $_SERVER['HTTP_USER_AGENT'] ) ){ @@ -15,6 +30,6 @@ class Helpers{ }else{ return false; } - } - } + } + } diff --git a/code/ryzom/tools/server/ryzom_ams/ams_lib/configs/ams_lib.conf b/code/ryzom/tools/server/ryzom_ams/ams_lib/configs/ams_lib.conf new file mode 100644 index 000000000..5eac748ec --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams/ams_lib/configs/ams_lib.conf @@ -0,0 +1,5 @@ +title = Welcome to Smarty! +cutoff_size = 40 + +[setup] +bold = true diff --git a/code/ryzom/tools/server/ryzom_ams/ams_lib/ingame_templates/index.tpl b/code/ryzom/tools/server/ryzom_ams/ams_lib/ingame_templates/index.tpl new file mode 100644 index 000000000..82495ff89 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams/ams_lib/ingame_templates/index.tpl @@ -0,0 +1,81 @@ +{config_load file="ams_lib.conf" section="setup"} + +
+ +{* bold and title are read from the config file *} +{if #bold#}{/if} +{* capitalize the first letters of each word of the title *} +Title: {#title#|capitalize} +{if #bold#}{/if} + +The current date and time is {$smarty.now|date_format:"%Y-%m-%d %H:%M:%S"} + +The value of global assigned variable $SCRIPT_NAME is {$SCRIPT_NAME} + +Example of accessing server environment variable SERVER_NAME: {$smarty.server.SERVER_NAME} + +The value of {ldelim}$Name{rdelim} is {$Name} + +variable modifier example of {ldelim}$Name|upper{rdelim} + +{$Name|upper} + + +An example of a section loop: + +{section name=outer +loop=$FirstName} +{if $smarty.section.outer.index is odd by 2} + {$smarty.section.outer.rownum} . {$FirstName[outer]} {$LastName[outer]} +{else} + {$smarty.section.outer.rownum} * {$FirstName[outer]} {$LastName[outer]} +{/if} +{sectionelse} + none +{/section} + +An example of section looped key values: + +{section name=sec1 loop=$contacts} + phone: {$contacts[sec1].phone}
+ fax: {$contacts[sec1].fax}
+ cell: {$contacts[sec1].cell}
+{/section} ++ +testing strip tags +{strip} +
+ + This is a test + + | +