Injecting Markup

The Theme Engine inject functionality is based on the assumption that you are using the delayed output setup and need to inject javascript, tags or markup into various places within your __main.php file.

You may define as many injectable areas in your _main.php file as needed and then those areas will be populated with the content of the inject variable at runtime.

To output the content of an inject variable:

$theme->outputMarkup('header');

or

echo $theme->getInjects('header');

You can populate any inject variable by doing this:

$theme->inject('header', $blog->feedLinks());

There are a lot of scenarios where you may require a template, view, or partial to be able to inject some markup into the head or foot, or even some other place in the page.

One example might be a blog listing where you want to inject an links to an RSS feed, as in the example above.

Last updated