xorinzor
xorinzor

Reputation: 6467

PageKit CMS - How to include a JS file in a view from a module

I've started working with the PageKit CMS (which I think is based on the symfony framework) but can't figure out how to include JS files in my view.

the documentation tells me to use <?php $view->script('theme', 'theme:js/theme.js') ?>

When I adjust this to match my module name it ends up looking like this: <?php $view->script('shoutzor', 'shoutzor:js/visualizer/main.js') ?>

But when I then load the page there's no <script> tag (or anything for that matter) regarding that js file.

What am I doing wrong here? since Pagekit is a fairly new CMS there's unfortunately hardly anything to find.

Upvotes: 2

Views: 349

Answers (1)

xorinzor
xorinzor

Reputation: 6467

Turned out I did 2 things wrong.

First off, the 1st parameter is a unique ID apparently, which I didn't realize causing it to only add the last script from the list.

After that I modified the line to resemble something like this:

<?php $view->script('shoutzor1', 'shoutzor:assets/js/visualizer/main.js'); ?>

Which included the correct asset file

Upvotes: 1

Related Questions