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

  • SEARCH
  • Home
  • 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 8747855
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T12:25:35+00:00 2026-06-13T12:25:35+00:00

My question looks almost the same as this Is it possible to put variables

  • 0

My question looks almost the same as this Is it possible to put variables inside config files?

I have a config file that controls the language. Also I have a feedback div that is showed for the feedback.

Now I want to assign feedback like this:

$smarty->assign('feedback', 'the_age_of_user_' . $user->name . '_is_changed_to_' . $user->age . '_years');

nl.conf

the_age_of_user_%s_is_changed_to_%s_years = De leeftijd van gebruiker %s gewijzigd naar %s jaar

en.conf

the_age_of_user_%s_is_changed_to_%s_years = The age of user %s is changed to %s years

Does anyone know how I can accomplish this? Or is there a better solution to assign variables to the config file?

  • 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-13T12:25:36+00:00Added an answer on June 13, 2026 at 12:25 pm

    Sorry, but I don’t completely understand what are you trying to accomplish.

    In our project, we have following solution for similar problem:

    Language file:

    the_age_of_user_is_changed = The age of user {user} is changed to {year} years

    Notice that there is no %s or any variables on left side. It is always constant.

    Option 1:

    1. Smarty/code assigment:
      $smarty->assign("VARIABLE_TO_USE_IN_TEMPLATE", getLang('the_age_of_user_is_changed', array('user' => $user->name,'year' => $user->age));

    2. Then, in Smarty, you can use following code: {$VARIABLE_TO_USE_IN_TEMPLATE}

    Function getLang reads string information from language files and replaces all {symbol} to corresponding data.

    Option 2:

    1. In template, we have smarty userspace function:
      {LANG key='the_age_of_user_is_changed' name=$user->name year=$user->age}
      Lang is actually calls function getLang from previous example.

    2. In code you have to assign user: $smarty->assign("user", $user);. After that, smarty will do everything by itself.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Absolute beginner question: I have a template file index.html that looks like this: ...
Quick question... I have a query that checks for duplicates that looks like this:
I asked Almost this exact same question yesterday. Basically I have a css button
This question is almost the same as a previous question , but differs enough
Okay guess this question looks a lot like: What is the best way to
Hello guys sorry if the question looks stupid to you. i have 3 tables
EDIT: In case the question below looks a bit 'extensive', the summary is that
It looks like this question has been asked dozens of times, but none of
Looks like this question has been asked thousand times already, but each person's configuration
I just saw this question and one of the answers looks really appealing to

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.