fn: inject/input
[contents]

Contents

Syntax

The syntax for inject/input calls is:

f++:  
input{options}(string)
inject{options}(string)

n++:  
@input{options}(string)
@inject{options}(string)

Description

The inject/input function is for injecting/inputting the output from parsing another file, it takes a single string parameter specifying the file to parse.

Note: Nift will not let you create an input loop, for example you cannot have @input(page.template) inside page.template, or any of the files that page.template injects, or any of the files that they inject, and so on.

Options

The following options are available for inject/input calls:

option description
f++ inject output of specified file parsed with f++
n++ inject output of specified file parsed with n++
raw inject specified file as raw text
if-exists inject specified file only if it exists (normally throws an error otherwise)
!i do not indent
option description

f++ example

Example of input being used with f++:

  1. <html>
  2. <head>
  3. @input("template/head.content")
  4. </head>
  5.  
  6. <body>
  7. @content
  8. </body>
  9. </html>

n++ example

Example of input being used with n++:

  1. <html>
  2. <head>
  3. @input("template/head.content")
  4. </head>
  5.  
  6. <body>
  7. @content
  8. </body>
  9. </html>