Jump to content

Recommended Posts

Posted (edited)

Hello, when im disabling IN_DEV mode, my custom loaded JS doesn't work.. What is a reason?
I'm loading they in my apps modules and in IN_DEV everything is good.

For example:
 

\IPS\Output::i()->jsFiles = array_merge( \IPS\Output::i()->jsFiles, \IPS\Output::i()->js( 'somthing.js', 'appTest', 'front' ) );

File is located in:

appTest>dev>front>somthing.js

 

Edited by Mac1
Posted (edited)
1 minute ago, desti said:

Have you forgotten to compile JS?

 

image.png.a5d62db34a0de33229a2b2eaba00b2ce.png

It seems not to work in my case. I'm using it in IN_DEV and remove that mode. JS doesnt work..

Edited by Mac1
Posted (edited)
49 minutes ago, Mac1 said:

appTest>dev>front>somthing.js

appTest>dev>js>front>controllers>folder>ips.folder.function.js

\IPS\Output::i()->jsFiles = array_merge( \IPS\Output::i()->jsFiles, \IPS\Output::i()->js( 'front_folder.js', 'appTest', 'front' ) );

// corrected

Edited by desti
Posted
27 minutes ago, desti said:

appTest>dev>js>front>controllers>folder>ips.folder.function.js

\IPS\Output::i()->jsFiles = array_merge( \IPS\Output::i()->jsFiles, \IPS\Output::i()->js( 'front_folder.js', 'appTest', 'front' ) );

// corrected

Wow, i'm trying this but doesn't work.
I have pushed JS to Applocation.php in init() and it works, but i don't want to do this that way.


Now it looks like:

dev/js/front/controllers/shop/ips.shop.something.js

\IPS\Output::i()->jsFiles = array_merge( \IPS\Output::i()->jsFiles, \IPS\Output::i()->js( 'ips.shop.js', 'appTest', 'front' ) );
and every similar combination i tried..

 

Posted
3 minutes ago, Adriano Faria said:

Have you added the data-controller to your JS and to your template?

I didn't

1 minute ago, desti said:

'front_shop.js'. 

Still it doesn't work 😞

Posted (edited)
5 minutes ago, Mac1 said:

I didn't

Example I use:

JS is on applications/movies/dev/js/front/controllers/movies/ips.movies.submit.js

On JS:

;( function($, _, undefined){
	"use strict";

	ips.controller.register( 'movies.front.movies.submit', {
		initialize: function()

On template:

<form accept-charset='utf-8' class="ipsForm {$class}" action="{$action}" method="post" {{if $uploadField}}enctype="multipart/form-data"{{endif}} {{if settings.movies_tmdb_api_key}}data-ipsForm data-controller="movies.front.movies.submit"{{endif}}>

On a PHP file (applications/movies/modules/front/movies/submit.php) :

\IPS\Output::i()->jsFiles = array_merge( \IPS\Output::i()->jsFiles, \IPS\Output::i()->js( 'front_movies.js', 'movies', 'front' ) );

 

Edited by Adriano Faria
Posted (edited)

@Adriano Faria but how to name a directory when i'm trying to implement JS in "Profile Extension"? This is not a controller in my case but an extension and "/controllers/" would not work 😞

Edited by Mac1
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...