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 9077885
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T19:29:03+00:00 2026-06-16T19:29:03+00:00

I have two arrays in a smarty template: $months and $contract. {$months|var_dump} gets this:

  • 0

I have two arrays in a smarty template: $months and $contract.

{$months|var_dump} gets this:

array (size=12)
1 => string ‘января’ (length=12)
2 => string ‘февраля’ (length=14)
3 => string ‘марта’ (length=10)
4 => string ‘апреля’ (length=12)
5 => string ‘мая’ (length=6)
6 => string ‘июня’ (length=8)
7 => string ‘июля’ (length=8)
8 => string ‘августа’ (length=14)
9 => string ‘сентября’ (length=16)
10 => string ‘октября’ (length=14)
11 => string ‘ноября’ (length=12)
12 => string ‘декабря’ (length=14)

array values are russian names of months in genitive.

{$contract|var_dump} gets this

‘date_till’ => ‘1355518365’ (length=10)

so I need to create a month number first from $contract.date_till. it is usually done like

{$contract.date_till|date_format:"%m"}

And now the question is: how do I extract a month name from $months array by the month number made of $contract.date_till with date_format?

I’ve tried many variants described in smarty manuals, but noone works. For example, this one doesn’t:
{$months[{$contract.date_till|date_format:"%m"}]}

  • 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-16T19:29:05+00:00Added an answer on June 16, 2026 at 7:29 pm

    {assign var=monthNo value=$contract.date_till|date_format:”%m”}

    {$months.$monthNo}
    This will give u the month of the necessary date.

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

Sidebar

Related Questions

I have two arrays like this : Array 1 is having x-axis values in
I have two arrays with time values in them in this format. 00:00:00 which
I'm using php with smarty. In php I have two arrays: $code = Array
I have two arrays... $Name = array(a, b, c, d); $Value = array(1, 2,
I have two arrays of strings: hrefs , thumbs . Need to combine this
I have two arrays: string[] Group = { A, null, B, null, C, null
I have two arrays. One is an array of names and the other is
I have two arrays: Array ( [0] => Array ( [id] => 1 [type]
I have two arrays. One is a larger bit of data: Array ( [12]
I have a multidimensional associative array, which I pass to a smarty template. I

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.