To use this website fully, you first need to accept the use of cookies. By agreeing to the use of cookies you consent to the use of functional cookies. For more information read this page.

Official ZPE/YASS documentationInline documents

Inline documents allow big strings to be inserted which fully ignore syntax. They are much like heredocs in other languages like PHP. They were added in ZPE 1.8.3 with YASS 18X.

Inline documents are started with the << (double less than symbol) and terminated by the >> (double greater than symbol).

This is a big thing for the web parser because it makes inline HTML within ZPE code far easier to write:

YASS
$code = <<
<html>
  <head>
    <title>This is a webpage</title>
  </head>
  <body>
    <h1>An example website</h1>
  </body>
</html>
>>

print($code)

Dangers

Inline documents use the double less than and double greater than signs as tokens for opening and closing. HTML also uses these tokens and if there is no space between the last closing tag in the HTML and the inline document closing token it becomes a triple greater than symbol causing the compiler to stop:

YASS
$code = <<
<html>
  <head>
    <title>This is a webpage</title>
  </head>
  <body>
    <h1>An example website</h1>
  </body>
</html>>>

print($code)

To prevent this, place a single space between the end of tag and the inline document closing tokens as shown in the first example

Inline variables

ZPE 1.8.4 added support for inline variables within inline documents.

YASS
for ($i = 0 to 10000)

  print(<<This is number {$i} in the list>>)

end for
    
Comments

There are no comments on this page.

New comment
Reply
Provide feedback on this page
Comments are sent via email to me.