A simple, flexible, fast, and security-focused PHP framework
Nephtali documentation


Learn about pipes, views, optblocks, data regions, and placeholders.

Example markup

<div id="products">
         <h3 id="product{id}">
            <a href="inf.php?id={id}">
         <ul id="specs{id|attr}">
            <li>Size: {size|html}</li>
            <li>Price: {price|html}<li>
            <li>Rating: {rating|html}</li>
               <a href="inf.php?id={id|url}">
                  Learn more…
   <p>There are no products.</p>
   <p>There has been an error.</p>
blog comments powered by Disqus

Nephtali markup types

  • <!--pipe:name-->

    Pipe comments delineate sections of markup that are dynamically controlled by Nephtali. Pipes contain one or more views, and pipes can be nested within other pipes (rendering works from the outside in.)

    In the example the products pipe is placed within a div and contains three possible views.

  • <!--view:name-->

    View comments delineate sections of markup that represent possible display states for a pipe. The 'default' and 'empty' view names are conventions for simple display pipes, and the 'error' view is required in every pipe.

    In the example the products pipe contains three views:

    Displayed when there are products.
    Displayed when there are no products.
    Displayed when an error has occurred somewhere in the processing of the pipe.
  • <!--optblock:name-->

    Optblock comments delineate sections of markup that are conditionally displayed depending on the the particular values being databound.

    In the example the ratings optblock is only shown if there are ratings present for the production being rendered.

    You can view example PHP code for optblocks in the API documentation under the n\view\render() function.

  • <!--data-->

    Data comments delineate sections of markup within views that should be databound. Markup within a set of data comments is repeated for every row that is databound.

    In the example the default view contains a data region that would repeat for every product listed.

  • {name}

    Placeholders map values within the rows databound to the markup by their respective keys. There are two forms of placeholders:

    The value is automatically escaped appropriately depending on context (url encoding, attribute encoding, or html encoding with allowed whitelists.)
    Values are escaped according to the escaping option explicitly provided in the placeholder. Possible options include:
    • html
    • attr
    • url