Location: PHPKode > scripts > DFL > dfl/example.html
<style type="text/css">
<!--
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
}
.style3 {color: #FF6600}
.style4 {color: #0000FF}
.style5 {color: #FF0000}
.style6 {color: #3300FF}
.style7 {color: #0099CC}
-->
</style>

<h1>Example Code</h1>

<pre><span class="style3">#         ______                           _        _____  ______ _      
#        |  ____|                         | |      |  __ \|  ____| |     
#        | |__  __  ____ _ _ __ ___  _ __ | | ___  | |  | | |__  | |     
#        |  __| \ \/ / _` | '_ ` _ \| '_ \| |/ _ \ | |  | |  __| | |     
#        | |____ >  < (_| | | | | | | |_) | |  __/ | |__| | |    | |____ 
#        |______/_/\_\__,_|_| |_| |_| .__/|_|\___| |_____/|_|    |______|
#                                   | |                                  
#                                   |_|                                  
#                                ______ _ _      
#                               |  ____(_) |     
#                               | |__   _| | ___ 
#                               |  __| | | |/ _ \
#                               | |    | | |  __/
#                               |_|    |_|_|\___|</span>

<span class="style3">// This is an example DFL file. Using CLI, you can run this file like PHP would run a .php file.
// Commented lines are prefixed with # or //. These lines are not processed, and are ignored like
// whitespace.</span>

<span class="style3">// First, let's define a method for downloading a file from a remote webserver.</span>
<span class="style3">
// First, we "build" the method.</span>
<span class="style4">MethodBuild</span> <span class="style5">Download</span>
<span class="style3">
// Next, we append to the method DFL code. This code will be executed when we call Download.
// The first line will be a function to download data from another server.</span>
<span class="style4">MethodAppend</span> <span class="style5">Download</span> <span class="style4">FNC</span> <span class="style5">download</span> <span class="style4">STR</span> <span class="style5">return implode('', file($args));</span>

<span class="style3">// Now let's define a variable called "return", and make it equal to the return of the execution of the
// function "download". We will pass an argument (variable args)</span>
<span class="style4">MethodAppend</span> <span class="style5">Download</span> <span class="style6">VAR</span> <span class="style5">return</span> <span class="style4">RUN</span> <span class="style5">download</span> <span class="style4">VAR</span> <span class="style5">args</span>
<span class="style3">
// Now, let's make the method return the "return" variable.</span>
<span class="style4">MethodAppend</span> <span class="style5">Download</span> <span class="style4">RET</span> <span class="style4">VAR</span> <span class="style5">return</span>

<span class="style3">###################</span>

<span class="style3">// Now let's work on the main script. The method is basically a function composed of DFL statements.
// Let's create a regular function to "echo" content.</span>

<span class="style4">FNC</span> <span class="style5">echo</span> <span class="style4">STR</span> <span class="style5">echo $args;</span>

<span class="style3">// Now, let's make a variable called "url". We'll store the URL we wish to download content from within
// that variable.</span>

<span class="style4">VAR</span> <span class="style5">url</span> <span class="style4">STR</span> <span class="style5">http://cmyip.com/</span>
<span class="style3">
// Now, let's run the "echo" function, passing the "url" variable as an argument which will be printed
// to the output buffer (echo'd)</span>

<span class="style4">RUN</span> <span class="style5">echo</span> <span class="style4">VAR</span> <span class="style5">url</span>
<span class="style4">RUN</span> <span class="style5">echo</span> <span class="style4">STR</span> <span class="style5"> --> Being downloaded...</span>

<span class="style3">// Let's make a function called newline which will return a newline.</span>

<span class="style4">FNC</span> <span class="style5">newline</span> <span class="style4">STR</span> <span class="style5">return newline();</span>

<span class="style3">// Let's print a newline.</span>

<span class="style4">RUN</span> <span class="style5">echo</span> <span class="style4">RUN</span> <span class="style5">newline</span>

<span class="style3">// Let's download the content of the page and store it in a variable.</span>

<span class="style4">VAR</span> <span class="style5">content</span> <span class="style7">Download</span> <span class="style4">VAR</span> <span class="style5">url</span>

<span class="style3">// Let's echo the content.</span>

<span class="style4">RUN</span> <span class="style5">echo</span> <span class="style4">VAR</span> <span class="style5">content</span>

</pre>
<h1>Example Output</h1>
<p>http://cmyip.com/--&gt; Being downloaded...</p>
<p>&nbsp;</p>
<p>&lt;html&gt;<br>
  &lt;head&gt;</p>
<p>&lt;title&gt;My IP is  67.166.21.212   - Quick and Easy way to SEE my IP address - CmyIP.com&lt;/title&gt;</p>
<p>&lt;/style&gt;<br>
  &lt;style type=&quot;text/css&quot;&gt;<br>
  &lt;!--<br>
  .style2 {color: #003399}<br>
  a:link {<br>
  font-size: 16px;<br>
  text-decoration: none;<br>
  }<br>
  --&gt;<br>
  &lt;/style&gt;<br>
  &lt;/head&gt;</p>
<p>&lt;body&gt;<br>
  &lt;p&gt;&amp;nbsp;&lt;/p&gt;<br>
  &lt;p&gt;&amp;nbsp;&lt;/p&gt;</p>
<p>&lt;table width=&quot;623&quot; align=&quot;center&quot;&gt;<br>
  &lt;tr&gt;<br>
  &lt;td width=&quot;615&quot;&gt;&lt;h1 align=&quot;center&quot; class=&quot;style2&quot; &gt;My IP is<br>
  67.166.21.212&lt;/h1&gt;&lt;/td&gt;<br>
  &lt;/tr&gt;<br>
  &lt;tr&gt;<br>
  &lt;td&gt;&lt;h2 align=&quot;center&quot; class=&quot;style2&quot;&gt;My country is United States    &lt;/h2&gt;&lt;/td&gt;<br>
  &lt;/tr&gt;<br>
  &lt;tr&gt;<br>
  &lt;td&gt;&lt;h2 align=&quot;center&quot; class=&quot;style2&quot;&gt;My city is Denver    &lt;/h2&gt;&lt;/td&gt;<br>
  &lt;/tr&gt;<br>
  &lt;tr&gt;<br>
  &lt;td align=&quot;center&quot;&gt;Quick and Easy way to SEE my IP address - CmyIP.com&lt;/td&gt;<br>
  &lt;/tr&gt;<br>
  &lt;tr&gt;<br>
  &lt;td align=&quot;center&quot;&gt;Powered by &lt;a href=&quot;http://www.Hide-IP-Soft.com&quot;&gt;Hide-IP-Soft.com&lt;/a&gt;&lt;/td&gt;<br>
  &lt;/tr&gt;</p>
<p>&lt;/table&gt;<br>
  &lt;/body&gt;<br>
&lt;/html&gt;</p>
<h1>Debugger Output Example </h1>

<p>
<pre>############ DEBUG CONSOLE ############
        [Stack Logging]
DFL Debug:(0):MethodBuild Download
DFL Debug:(0):MethodAppend Download FNC download STR return implode('', file($args));
DFL Debug:(0):MethodAppend Download VAR return RUN download VAR args
DFL Debug:(0):MethodAppend Download RET VAR return
DFL Debug:(0):FNC echo STR echo $args;
DFL Debug:(1):|--->STR echo $args;
DFL Debug:(0):VAR url STR http://cmyip.com/
DFL Debug:(1):|--->STR http://cmyip.com/
DFL Debug:(0):RUN echo VAR url
DFL Debug:(1):|--->VAR url
DFL Debug:(0):RUN echo STR  --> Being downloaded...
DFL Debug:(1):|--->STR  --> Being downloaded...
DFL Debug:(0):FNC newline STR return newline();
DFL Debug:(1):|--->STR return newline();
DFL Debug:(0):RUN echo RUN newline
DFL Debug:(1):|--->RUN newline
DFL Debug:(0):VAR content Download VAR url
DFL Debug:(1):|--->Download VAR url
DFL Debug:(2):     |--->VAR url
DFL Debug:(2):     |--->FNC download STR return implode('', file($args));
DFL Debug:(3):          |--->STR return implode('', file($args));
DFL Debug:(2):     |--->VAR return RUN download VAR args
DFL Debug:(3):          |--->RUN download VAR args
DFL Debug:(4):               |--->VAR args
DFL Debug:(2):     |--->RET VAR return
DFL Debug:(3):          |--->VAR return
DFL Debug:(0):RUN echo VAR content
DFL Debug:(1):|--->VAR content
        [Engine Logging]
[DFL]::DFL -> Engine to process kittens.dfl
        [Output Buffer]
http://cmyip.com/--> Being downloaded...
<span class="style5">(..Displayed Above..)</span>
        [Function Dump]
echo
newline

        [Variable Dump]
url
content

        [Public Method Dump]
Download        (3 lines)

        [Other]
Execution time: 0.38775515556335 second(s)
Processed: 1 file(s)
Variable Count: 2
Function Count: 2
Buffer Length: 897</pre>
</p>
Return current item: DFL