Plugin to render article with javascript


#1

Hello,
I want to write a plugin that render articles using some javascript, how should I do that? I tried this

function init($host) {
$this->host = $host;

    $host->add_hook($host::HOOK_RENDER_ARTICLE, $this);
}

function hook_render_article($article) {
$article[“content”] = “<script src=’/path/to/js’></script>” . $article[“content”];

    return $article;
}

and similar thing with HOOK_ARTICLE_FILTER, but both didn’t work.