Going to Different Parts of the Program or to Other Websites🔗
Going to Different Parts of the Program🔗
Sometimes, we may want the user to go immediately to other parts of the program, for example, depending on how they answer a given question. This can be done using the *goto
and *label
keywords. Note that *label
is different than *tags
, as *label
acts as a "road marker" or a flagged point at which to land, whereas *tags
"categorizes" something to recall later, similar to the "hashtag" (#) in many social media platforms. Take a look below.
*label: woodchuckQuestion
*question: How much wood can a woodchuck chuck?
*question: Do you want to reconsider that answer?
Yes
*goto: woodchuckQuestion
No
Fine then, moving on...
In this example, users who select "Yes" in the second question jump immediately to the label, and will once again see the woodchuck question. Users who select "No" will see the text "Fine then, moving on..." To make this happen, a *label
was placed above the woodchuck question. The purpose of a *label
is to specify a particular point in the program. A label's name can have any combination of letters and/or numbers (though it cannot have spaces or special characters). Here, the *label
was given the name "woodchuckQuestion". Once a user selects the "Yes" option, they reach the line with the *goto
keyword, which commands the program to go to the particular label that is specified. In this case, the *goto
keyword said "woodchuckQuestion," sending the user immediately to the point in the program that has the label with that name.
Note: You can also give users a link to your program that starts them immediately at a *label
of your choosing (instead of the very beginning). To learn how to do that, click here.
Going Immediately to Other Websites🔗
You can use *goto
to automatically send your users away from your program and onward to a new website.
Why would you want to do this?
- At the end of your program, automatically send your users to your personal website.
- Create a tool that first understands your user's needs, then automatically sends them to a website that can help them.
- Send your users to other GuidedTrack programs (i.e. other run links). For instance, create a teaser program that describes the features of a much larger program (e.g. one that will take multiple weeks to complete). When the teaser ends and users decide they definitely want to try the rest, use *goto to send them to a new program URL that requires them to login before they can view more.
- Whatever else you can imagine!
The code for this is pretty simple. For example:
I'm done with you! Go to this website instead:
*goto: http://www.guidedtrack.com
Users won't actually see the text in the example above (it'll only flash on the screen briefly). Instead, they will automatically be taken to the GuidedTrack website (in the same tab/window, not in a new tab/window). Note: whenever a *goto
keyword sends users to a new website, their current run in your program ends.
Next: Headers