• Login
  • login to access premium content (it's free).

Semicolon URL notation with HTML/OS

Sometimes it is desirable to use the semicolon notation to reuse overlay's. Instead of duplicate overlays we can instead opt to use semicolon notation.

This allows you to reference a single overlay from multiple pages.

The problem

The main issue with doing it this way is the "page" value gets lost.

index.html

<!doctype html>
<html lang="en">
 <head>
  <meta charset="utf-8">
  <title></title>
 </head>
 <body>
  <a href="master.overlay;doit">Run doit Overlay</a><hr>
 </body>
</html>

master.overlay

<<goto error(400)>>
<<overlay doit
 goto page
>>

The Solution

To overcome that you can use the following coding pattern.

index.html

<<
expand file="/system/clearimage/DLL.lib" /expand
>>
<!doctype html>
<html lang="en">
 <head>
  <meta charset="utf-8">
  <title></title>
 </head>
 <body>
  <a href="<<page>>">RELOAD</a><br>
  <a href="<<pagelink('master.overlay;doit','qwerty','Terry')>>">doit</a><hr>
  <<page>><br>
  <<page_>><br>
  <<page_()>><br>
  <<pagefromdoit>><br>
  <<qwerty>><<qwerty='ERROR'>>
 </body>
</html>

master.overlay

<<goto error(400)
 # 
 # This is a pattern for master overlay's 
 # 
 # To call a master overlay use the following syntax
 #
 # <a href="<<pagelink1('master.overlay;doit')>>">Run Do It</a>
 # <a href="<<pagelink('master.overlay;doit',varname,varvalue)>>">Run Do It</a>
 #
 # execute get_() to initialize each overlay
 # 
 # Use page_ in place of page for goto's
 # tag can also be used for goto's
 # 
 # notice the goto error(400) that will be invoked if you forget and do a goto page
/#
>>

<<overlay doit get_()

 pagefromdoit='Welcome: '+qwerty+' '+random(1000,9999)+' '+page_+' '+page+' '+page_()+' '+tag
 goto page_

>>

Thats it for now.