Skip to content

Commit

Permalink
Update documentation with new method implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
unreal4u committed Jun 5, 2017
1 parent 3d46fc9 commit 98e3780
Showing 1 changed file with 30 additions and 1 deletion.
31 changes: 30 additions & 1 deletion examples/send-message-with-inlinekeyboard.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,35 @@
// 0
$row = null;

// Choose one of the following 2 methods:

// METHOD 1: all in once with an array construction
$inlineKeyboard = new Markup([
'inline_keyboard' => [
[
['text' => '1', 'callback_data' => 'k=1'],
['text' => '2', 'callback_data' => 'k=2'],
['text' => '3', 'callback_data' => 'k=3'],
],
[
['text' => '4', 'callback_data' => 'k=4'],
['text' => '5', 'callback_data' => 'k=5'],
['text' => '6', 'callback_data' => 'k=6'],
],
[
['text' => '7', 'callback_data' => 'k=7'],
['text' => '8', 'callback_data' => 'k=8'],
['text' => '9', 'callback_data' => 'k=9'],
],
[
['text' => '0', 'callback_data' => 'k=0'],
],
]
]);


// METHOD 2: in parts, working directly with the object
/*
$inlineKeyboard = new Markup();
for ($i = 1; $i < 10; $i++) {
$inlineKeyboardButton = new Button();
Expand All @@ -37,7 +66,7 @@
$inlineKeyboardButton->text = '0';
$inlineKeyboardButton->callback_data = 'k=0';
$inlineKeyboard->inline_keyboard[][] = $inlineKeyboardButton;

*/
$sendMessage->disable_web_page_preview = true;
$sendMessage->parse_mode = 'Markdown';
$sendMessage->reply_markup = $inlineKeyboard;
Expand Down

0 comments on commit 98e3780

Please sign in to comment.