This stuff is really just for web apps!
Most of it isn’t applicable for Bubble’s new mobile builder, BUUUUUUUUT BUT BUT! This is the absolute BACKBONE of ALL of my apps, so it might still be worth a read.
What this is:
Bubble doesn’t give you dynamic access to the pages and views in your app. But sometimes you want to say, “this thing happened here” or “when a person is on this page, do this.” So in each app I build, one of the first things I do is create a system of option sets that I use for a whole host of things.
First the setup, and then the explanation...
The Setup:
Create three option sets:
“App Locations” option set for your Pages and Big Deal Reusables (usually only Header Bar, Sidebar Menu & Footer). This option set should contain these attributes (plus any other that make sense):
“Displays” option set for the displays within pages. Attributes should be:
“Menu Items” option set for all possible menu items in your sidebar or top nav bar. Attributes should be:
The menu item attributes are mostly used in the UI - for determining the search that displays the appropriate menu items. It’s also used for navigation.
Use Cases for this:
Event logging - in order to get robust analytics about where things are happening in your app, you need to be able to save to your the specific view/page where things happened. Scalable Menus - Once this system is set up and your Menu UI and workflows are built, you can easily scale it by simply adding a new option to the Menu Items option set and setting all the attributes. How Navigation Works
This entire system is built around a dynamic navigation system that handles everything. It’s a Reusable Element called “Global Nav” with a set of custom workflows in it - one for each page in your app.
The custom workflows have properties for any of the possible bits of data that need to be sent to that page via URL parameters.
This reusable is placed on every page, and in most other reusables. Then, from the page (or other reusable), instead of a “Go to page” action, you...
Use the “Trigger Custom Event from Reusable Element” action Select the custom event that corresponds to whichever page you want to go to Add whatever properties are required This system works alongside another reusable called “Global Variables” which reads the URL for the current “Display” and other important bits of data.
This system is BEAUTIFUL in that you never have to remember what url parameters to send to a page. The workflow handles all of it for you, and if you need to make updates, you just make them in that one place instead of all over the app.
A note about this: This system uses URL parameters for navigation, but you could use a similar setup for paths.