View variables and arrays in Smarty

How smarty displays variables and arrays.

By the way php side has been set what value to return to the template, here we introduce only the treatment of smarty in the template as work on the front side.

View the variables that are passed across the template.

First, it is a simple display of variables that are neither arrays nor objects.
If there is a variable of $arena_rank, just come with {} as follows.Now the template

Ranking {$arena_rank}

Show arrays across a template


The contents of $rank_list were as follows when i checked the contents in the following debug_print_var introduced the other day.


For example, if you want to display the first Yamada in the above example, it will be as follows.
There are several ways to write.


The same is true for associative arrays.
Let's say the values that have been passed over the $user are as follows:

By mail

If you want to see the mail address


You can also use the key of a variable when displaying an array.


The name displayed by the number in the arena_rank changes.

It is an introduction of the basic display method.

Leave a comment

Your email address will not be published. Required fields are marked *