Hi,
I like to reduce the code redundancy in our TPL. The main TPL is calling a sub tpl to include the metadata. This should happen on several cases (see the if statements)
Here's what I did.
[html]
<%
if(Request.QueryString["lang"] == "fre" || Request.QueryString["lang"] == "fr"){
%>
$iw_param{language} = "fre";
<%
}else if(Request.QueryString["lang"] == "por" || Request.QueryString["lang"] == "pt"){
%>
$iw_param{language} = "por";
<%
}else{
%>
$iw_param{language} = "por";
<%
}
%>
[/html]
Instead of repeating the section 3 times, I like to call a perl function like follows which in turn will have the .
[html]
sub display_lang_code{
($lang) =
@_;
$iw_param{language} = $lang;
}
[/html]
However, when I make a call to the perl function it simply puts the output of the metadata tpl after all the if statements section. What should I do reduce the same code in one tpl.
Please advise,
Thanks,
Anna.