From 9af85360ce7dec9570df6ae2a798a90e9e78cf90 Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Sat, 3 Sep 2011 10:05:24 +0200 Subject: [PATCH] Now we can call the get_lang function from the template!!! --- main/inc/lib/template.lib.php | 5 ++++- main/template/experimental/layout/layout_two_col.tpl | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/main/inc/lib/template.lib.php b/main/inc/lib/template.lib.php index 948c7bb6f8..2838cddb3e 100644 --- a/main/inc/lib/template.lib.php +++ b/main/inc/lib/template.lib.php @@ -8,7 +8,7 @@ require_once api_get_path(LIBRARY_PATH).'smarty/Smarty.class.php'; class Template extends Smarty { - var $style = 'default'; //see the template folder + var $style = 'experimental'; //see the template folder function __construct($title = '') { $this->title = $title; @@ -48,7 +48,10 @@ class Template extends Smarty { $this->set_header_parameters(); $this->set_footer_parameters(); + //Now we can call the get_lang from a template!!! Just use {"MyString"|get_lang} + $this->registerPlugin("modifier","get_lang", "get_lang"); + //$this->loadPlugin('smarty_function_get_lang'); //$this->caching = Smarty::CACHING_LIFETIME_CURRENT; $this->assign('style', $this->style); diff --git a/main/template/experimental/layout/layout_two_col.tpl b/main/template/experimental/layout/layout_two_col.tpl index 22c2e1bcdb..d0f029dcb1 100644 --- a/main/template/experimental/layout/layout_two_col.tpl +++ b/main/template/experimental/layout/layout_two_col.tpl @@ -5,7 +5,7 @@ {/block} {block name=body} -

My experimental Template!!

+

{"WelcomeUserXToTheSiteX"|get_lang}

{$home_page_block} {$plugin_courses_block}