S
S
shiva12018-11-09 12:45:44
Telegram
shiva1, 2018-11-09 12:45:44

How to arrange buttons in a message in several rows?

Good day.
I am writing a small bot for telegrams, and I ran into an unpleasant problem that I could not solve right off the bat.
I give the user a message and form an array of buttons like this

$keyboard = array($buttons);
$resp = array("keyboard" => $keyboard,"resize_keyboard" => true,"one_time_keyboard" => true);
$reply = json_encode($resp);

The problem is that they are displayed in one line and on devices with a small screen, the buttons become small and the text on them is cut off. But I saw that you can create such buttons by placing them in several rows. The main question is where to look at an example? I didn't see how it could be done.
Thanks

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
shiva1, 2018-11-09
@shiva1

Figured it out on my own.
In the $buttons line, this is a one-dimensional array. For example . But it's worth making it two-dimensional - - and the buttons line up in two rows.
array(array('1'),array('2'))

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question