Jump to content

improve Helpers to work in front end


Ali Majrashi

Recommended Posts

Hello,

i'm developing new simple app that show statistics and it's difficult to use \IPS\Helpers\Chart\Dynamic in front end every things work fine except javascript since this class use javascript that only load in ACP the same thing with other Helper classes that only work in ACP

i think all helpers should be global and we can use them in front end and admin panel without limitations

i hope there is workaround on this limitation for now :cry:

Link to comment
Share on other sites

2 hours ago, HeadStand said:

Have you tried loading it manually?


\IPS\Output::i()->jsFiles = array_merge( \IPS\Output::i()->jsFiles, \IPS\Output::i()->js( 'admin_core.js', 'core', 'admin' ) );

I don't see why that shouldn't work.

by inspecting the console the JS files load without issues i'm lost now:cry:

this is the logged info in the console 

Quote

[Info] Enabled logging (Debug.js, line 184)
[Log] Loading: core/interface/jquery/jquery-ui.js (Debug.js, line 180)
[Log] Loading: core/front/controllers/widgets/ips.widgets.block.js (Debug.js, line 180)
[Log] Loading: core/admin/controllers/core/ips.core.dynamicChart.js (Debug.js, line 180)
[Log] Loaded: core/interface/jquery/jquery-ui.js (Debug.js, line 180)
[Log] Loaded: core/front/controllers/widgets/ips.widgets.block.js (Debug.js, line 180)
[Log] Loaded: core/admin/controllers/core/ips.core.dynamicChart.js (Debug.js, line 180)

they load twice and ajax request will keep firing 

Quote

[Log] Notifications: sending ajax request (Debug.js, line 180, x7)
[Log] Notifications: Resetting inactive poll. (Debug.js, line 180)
[Log] Notifications: sending ajax request (Debug.js, line 180, x2)
[Log] Notifications: Resetting inactive poll. (Debug.js, line 180, x3)
[Log] Notifications: sending ajax request (Debug.js, line 180)
[Log] Notifications: Resetting inactive poll. (Debug.js, line 180)

i'm using the same code in core\modules\admin\stats\registrationstats.php

in ACP this is the log info

Quote

[Info] Enabled logging (Debug.js, line 184)
[Log] Loading: core/interface/jquery/jquery-ui.js (Debug.js, line 180)
[Log] Loaded: core/interface/jquery/jquery-ui.js (Debug.js, line 180)
[Info] contentChange event, reinitializing widgets in ips_uid_4713_2 (Debug.js, line 184)

the same with Matrix Form helper it's only work in ACP

 

Link to comment
Share on other sites

On 12/02/2016 at 3:48 AM, Ali Majrashi said:

by inspecting the console the JS files load without issues i'm lost now:cry:

this is the logged info in the console 

they load twice and ajax request will keep firing 

i'm using the same code in core\modules\admin\stats\registrationstats.php

in ACP this is the log info

the same with Matrix Form helper it's only work in ACP

 

It only loads it once - it logs "loading" and "loaded". The ajax things logged are for the notification polling that goes on, and aren't because you've added more scripts. It doesn't show up in ACP because there's no live notification polling in ACP.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

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