ee-garage.com

Cache and transplant tag output for multiple use elsewhere in your templates.

NSM Transplant is an ExpressionEngine 2.0 port of LG Replace. The purpose of the plugin is to temporarily cache rendered tagdata and re-render it outside of it's original context eg: a {exp:channel:entries} tag.

A simple example

Inside your channel entry there is a list of related links in a textarea. Those links need to be rendered in a sidebar outside of the original tag. Here's how it's achieved:

{exp:nsm_transplant:body}

  {exp:channel:entries}
    {title}
    {exp:nsm_transplant:content id="my_entry_links"}
      {links}
    {/exp:nsm_transplant:content}
  {/exp:channel:entries}

  {!-- A second channel:entries tag --}
  {exp:channel:entries}
    {title}
    {content}
  {exp:channel:entries}

  {!-- 
    Inside the {exp:nsm_transplant:body} tag
    Outside the original {exp:channel:entries}
    Render the cached entry links with {my_entry_links}.
  --}
  {my_entry_links}

{/exp:nsm_transplant:body}

{!-- 
  Outside {exp:nsm_transplant:body} use
  {exp:nsm_transplant:output} to render the cached content
--}
{exp:nsm_transplant:output id="my_entry_links"}

The example above is simple but it demonstrates how to reduce the template by at least one {exp:channel:entries} tag.

A complex example

Here is a video on how Etsur use Matrix, Wygwam, NSM Transplant, ED Imageresizer etc. to accomplish user image/wysiwyg editing in ExpressionEngine on Vimeo.

Releases RSS Feed © Copyright 2014 | Policies All prices shown are in Australian Dollars ($AUD) Newism