Jump to content

Issue installing application on live server


Go to solution Solved by Mick23,

Recommended Posts

Posted (edited)

Hi folks,

My application that is working in my dev environment is behaving differently (ie: not at all) when "installed" in the live environment.

I realise that I may be missing some configuration steps here so please bear with me.

  1. I downloaded a new build of my application from the developer centre
  2. I uploaded the .tar file to my live applications directory
  3. I extracted the file into a directory of its own
  4. From the admin cp, I installed the application as it was now visible in the list
  5. Installation did not show any errors
  6. Going to the game page I do not get any php or javascript errors, and using the inspector shows that the javascript did not appear to run. Part of the page where there is supposed to be an image and a label that shows one of the template parameters.

I should be seeing:

Could contain: Text, Page

Instead I see:

Could contain: Text, Page, Number, Symbol

Cheers!

Mick

Edited by Mick79
Posted
3 minutes ago, Mick79 said:
  • I uploaded the .tar file to my live applications directory
  • I extracted the file into a directory of its own
  • From the admin cp, I installed the application as it was now visible in the list

Not the problem you're facing but you don't need to do this. Simply install the app by upload the .tar directly in the ACP -> System -> Applications page.

Posted
2 minutes ago, Adriano Faria said:

Not the problem you're facing but you don't need to do this. Simply install the app by upload the .tar directly in the ACP -> System -> Applications page.

My web host has a really annoying spam filter that gives me 403 errors when I try to do this, so for now it's a workaround 🙂

Posted

Yes I did, thanks.  I just used the inspector and can see that the images are present, but not visible (as the visibility of the image element is toggled based on a condition in the javascript. So that's one mystery solved 🙂

The first line of my initialise function is:

initialize: function () {
  this._phrase = ips.getSetting('phrase');
  ...
}

On dev this works fine, on my live env it does not appear to run at all. I'll put some console.log calls in to see if I can see where it's dying (or if it's executing at all).

Posted

Sure is:

\IPS\Output::i()->jsFiles = array_merge(\IPS\Output::i()->jsFiles, \IPS\Output::i()->js('gameplay.js', 'hangman', 'gameplay'));

What's baffling me is why it wouldn't work on the live env vs the dev one.

I added some console logs in initalize() that work on live but not on dev.

Posted

It may be that my dev/js folder structure is not correct:

/dev/js/gameplay.js

I do not have the "front" subfolder that is present with css files. Is this an issue? I have noticed that the docs state:

For example, if we created javascript files in dev/js/front/mygroup/somefile.js, then the bundle name would be front_mygroup.js (location, underscore, groupname), and loaded as follows:

\IPS\Output::i()->jsFiles = array_merge( \IPS\Output::i()->jsFiles, \IPS\Output::i()->js( 'front_mygroup.js', 'app', 'location' ) );

But I am not using the underscored bundle name, I don't think? Maybe I just need to sleep on it, it's been a long day already 🤣

Posted
\IPS\Output::i()->jsFiles = array_merge(\IPS\Output::i()->jsFiles, \IPS\Output::i()->js('gameplay.js', 'hangman', 'front'));

With the file at /dev/js/front/gameplay.js - the above works on dev, fails on live.

If I add the change it to 'front_gameplay.js' then it fails on dev and live.

Posted (edited)

See this example:

File:

  • applications/volunteer/dev/js/front/controllers/search/ips.volunteer.search.js

Call:

  • \IPS\Output::i()->jsFiles = array_merge( \IPS\Output::i()->jsFiles, \IPS\Output::i()->js( 'front_search.js', 'volunteer', 'front' ) );

 

Edited by Adriano Faria
Posted (edited)

Move the js to a folder as follows-> /dev/js/front/banana/controllers/gameplay.js

\IPS\Output::i()->jsFiles = array_merge(\IPS\Output::i()->jsFiles, \IPS\Output::i()->js('front_banana', 'hangman', 'front'));

Refer to the main IPS code - do a search of the files in your IDE for \IPS\Output::i()->js( and then match up what you see in that to what you see in that apps /dev/js/ folder, and things become clearer (the addition of 'controllers' and 'templates' in to the mix doesn't appear covered in documentation)

Edited by Nathan Explosion
  • Solution
Posted

I figured it out, the front/controllers/... folder structure is required for the files to compile properly:

Could contain: Text

This code now works with gameplay.js in the gameplay folder:

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

Thank you all for your assistance 🙂

This was the thread that tipped me off:

 

  • Recently Browsing   0 members

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