Here I go again...

I created a site helper tag which works basically. The PHP code in it outputs a variable, let's say $output. This output should be displayed. In the template the tag, let's call it {{ site:output }}, is pasted beneath a H5 heading. But the output by the tag gets rendered above this H5 (but inside the body although it's beneath it in the template.

My Tags.php:


namespace Statamic\SiteHelpers;

use Statamic\Extend\Tags as AbstractTags;

class Tags extends AbstractTags
     * The {{ site:example }} tag
     * @return mixed
    public function output()
          echo 'This is the output.';

My template:

{{ site:output }} <!-- Outputs: "This is the output" -->

The output:

This is the output.


I don't really know why this is.

Answered by Erin Dalzell! Go to answer.