Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9124435
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T06:34:17+00:00 2026-06-17T06:34:17+00:00

I have a site (using Smarty template) which is multilingual. All the languages are

  • 0

I have a site (using Smarty template) which is multilingual. All the languages are in a different lang.ini file.
E.g.:
lang/eng/lang.ini: (In English)

WELCOME = "Welcome"

lang/hun/lang.ini: (In Hungarian)

WELCOME = "Üdvözöllek"

Then in the index.php:

... 
$error=array(); 
if($condition!=$condition2) 
{ 
     $error1 = "This is an error msg"; 
     array_push($error, $error1); 
} 
... 
$this->tpl->assign('error', $error); 
$lang_file=parse_ini_file("lang/". $_SESSION["lang_folder"] ."/lang.ini",true); 
$this->tpl->assignByref("lang",$lang_file); 
$this->tpl->display('index.tpl');

Finally in the index.tpl:

... 
{$lang.WELCOME} 
<br /> 
{if isset($error) && $error ne "" } 
   {foreach $error as $error_list} 
      {$error_list} 
   {/foreach} 
{/if} 
...

Now the Welcome can appear in different languages (the path stored in session).
But the $error appears only one language, only print out it’s value.
How can I print it out depending which language is selected? Where should I add value to the $error?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T06:34:18+00:00Added an answer on June 17, 2026 at 6:34 am

    When detecting the error, rather than pushing the English string into your array, push the code you want to retrieve from your INI file:

    if($condition!=$condition2) 
    { 
        array_push($error, 'ERROR_ONE'); 
    }
    

    Then in Smarty, use that as a key in your $lang array using normal array access syntax:

    {foreach $error as $error_code} 
        {$lang[$error_code]} 
    {/foreach}
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have following codes using smarty template engine In php file: $smarty-&gt;assign('SITE_URL', 'http://localhost/mis/'); In
On a PHP site using the smarty template engine (or at least a close
I have a site which is using DNN (DotNetNuke) as a content management system.
I have the following code on my site (using php and smarty) to try
I have a site, from which you can download an HTML file. This HTML
I have a site using CF8 and Fusebox 5. Anytime I need to add
I have built a site using php and want to try keep it one
I have a django site using the basic django registration framework. I have my
I have a site search (using Examine & Razor) that breaks if a space
I have created a basic site using ASP.NET routing according to Mike Ormond's example

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.