Created
June 9, 2020 19:17
-
-
Save mmuoDev/06ee43b02269c8d489c949941f0e1d1c to your computer and use it in GitHub Desktop.
whatsapp chatbot navigation in sub-menus
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if((int)$query == 0){ | |
$states = #fetch states from the session | |
if(count($states) > 1){ | |
$count = count($states); | |
$prev = $count - 2; | |
$prev_state = $states[$prev]; | |
if($prev_state != '0'){ | |
//go to previous key - /menus/{$prev_state} | |
//show sub-menus | |
//contatenate '0. Previous Menu' | |
//remove current state and set prev_state to current | |
unset($states[$count-1]); | |
//save 'states' in session | |
}else{ | |
//show main menu | |
//delete states from session | |
$state_id = '0'; | |
$states[] = $state_id; | |
#save 'states' in session | |
} | |
}else{ | |
//show main menu | |
//delete states from session | |
$state_id = '0'; | |
$states[] = $state_id; | |
#save 'states' in session | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment