A full blown injection

Here is a complete injection example, with all the components nicely put. I’m going to describe everything is detail. Note that this is not just a summary of what you have seen in previous sections.

{[ 3 | .last-comments(1) | .comment-template | .show-comments(2) ]} (i-1)

Show here the 3 last comments (with a certain template).

An Nzymes injection should be easy to read from left to right and understand what it does and how it does it. In the (i-1) injection there are four enzymes:

enzyme 1: ´3´

  • From its shape we see that it is a literal number transclusion enzyme.
  • It puts a 3 onto the internal stack.

enzyme 2: ´.last-comments(1)´

  • From its shape we see that it is a post custom field execution enzyme.
  • From the number inside its parentheses we see that it pops the topmost 1 item from the internal stack.
  • From the custom field name we suppose that it should put an array of the last 3 comments onto the internal stack.

enzyme 3: ´.comment-template´

  • From its shape we see that it is a post custom field transclusion enzyme.
  • From the custom field name we suppose that it should put a comment template onto the internal stack.

enzyme 4: ´.show-comments(2)´

  • From its shape we see that it is a post custom field execution enzyme.
  • From the number inside its parentheses we see that it pops the topmost 2 items from the internal stack.
  • From the custom field name we suppose that it should put the visualization of the last 3 comments filtered through the comment template onto the internal stack.

Note that the (i-1) injection follows a popular web programming pattern: Model View Controller.


Nzymes | WordPress Plugin

{[ defer(15) | 1.enable-enzymes() ]}