Jamie Balfour

Welcome to my personal website.

Find out more about me, my personal projects, reviews, courses and much more here.

Official ZPE/YASS documentationInline documents

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 below:

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

print($code)

Comments
Feedback 👍
Comments are sent via email to me.