I have created a menu in bubble where according to the current page the corresponding menu text should get highlighted.
For this, when page is loaded, I’m using custom state to save the result of “Get path from page url”. For some reason, the result of this is showing empty. Can anyone explain why?
Literally, add the path to the URL. Like, type it in. You can structure your own URLs.
(But why would you even structure a URL this way? /page_name/page_name makes no sense. So the question is, if you already have a page called /page_name, isn’t that what you wanted in the first place? Why are you jacking around with reading the path back? Just go to /page_name and be done with it.)
I am not concerned with how the page url looks, I need to extract page name or something else from the url so that the app knows which page the user is on and corresponding menu item gets highlighted.
If you know any other way of doing this let me know.
Welllll… I think you’re missing a very fundamental point. There’s no such thing as “your app knowing what page the user is on.”
The page is either active or not. If no user is using the page, we do not care. And your app neither knows this nor doesn’t know this. Your app does not “know.”
If the user (be that user you, me, or the Googlebot) is on the page… The page will run. The page will not run otherwise. We do not need to detect this state.
When we design a page, we design it for a user we imagine using the page. If no user ever reaches the page, our imagination is for naught. But it does not matter.
Should a user get to the page, the page will execute. You are designing and programming your pages for this imagined situation. (Which of course you can test… by visiting the page yourself… as when you “Preview” the page.)
Now would be a good time, perhaps, to revisit the tutorial lessons.