Skip to content

Instantly share code, notes, and snippets.

@alexnask
Created December 3, 2010 20:05
Show Gist options
  • Save alexnask/727476 to your computer and use it in GitHub Desktop.
Save alexnask/727476 to your computer and use it in GitHub Desktop.
File 'includes' and variable declarations in ooc
<%
Set: a,"a"
ReadFile: data,"fileB.thtml"
Execute: data
Show: b
%>
<%
Show: a
Set: b,"b"
%>
This outputs ab
Conclusion: the scope of "true" code execution and code executed by "Execute" function is the same. Thus, you can do things like prepared outputs (example bellow)
SomeFile.thtml:
<%
Database: "someDb"
Column: Title,"title"
Column: id,"id"
ReadFile: data,"foo.thtml"
for[i: 0 .. 5]
{
Set: title,Title(i)
Set: id,id(i)
Execute: data
}
%>
foo.thtml:
<h1><%Show: title;%></h1>
<p>With id <%Show: id;%></p>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment