mesnitu / EasyPopulate4BookX

Data import and export module for Zencart 1.3.x and 1.5.x
GNU General Public License v2.0
1 stars 0 forks source link

javascript notifier #11

Closed mc12345678 closed 8 years ago

mc12345678 commented 8 years ago

The request was to have javascript load after the footer of the EP4 code but before the close of the body tag. Is there a reason that this code couldn't be loaded earlier in the process? Must it be in/after the footer? There are several other notifiers in which some javascript code could be echo'd to the user and there is not much "distance" between them and the footer while still being within the body tags.

mesnitu commented 8 years ago

Well, it's a good pratice, but it can be even in the header, The closest one is $zco_notifier->notify('EP4_FILENAMES'). But it's not intuitive. The way I see it, it would provide more freedom not only to this code, but to whatever code someone could do related to changes in EP4. In fact, ideally one would have a way of not messing with EP4 core and have the hability to place in header ( so it's done), opening body, and the footer. Will it be used or not, don't know, it's just opening possibilities.
So for what I've asked it would look like: <?php require(DIR_WS_INCLUDES . 'footer.php'); $zco_notifier->notify('EP4_EASYPOPULATE_4_LINK_END'); ?>

mc12345678 commented 8 years ago

I was actually thinking any of the following: <?php $zco_notifier->notify('EP4_EASYPOPULATE_4_LINK'); ?> which is just before other javascript files are loaded and just after stylesheets are loaded (allowing additional stylesheets to override existing settings.) Or: $zco_notifier->notify('EP4_DISPLAY_STATUS'); Or: $zco_notifier->notify('EP4_LINK_SELECTION_END');

Each of these make more sense than the filenames location which is intended really just for that part of the data, not necessarily to output information to the screen...

As to the notifier in the footer, I've previously requested such a notifier to be incorporated; however, the reason(s) I provided did not support incorporation. Comes back to the why does it need to be at/after the footer? Header I think is possible (haven't looked at the admin header code to see if there is a notifier on the admin side, but there is in most headers on the catalog side).

mesnitu commented 8 years ago

Well, I can try in there, if this is so complicated. It can go to the header too. Nothing special his happening there, I just thought that on export / import it would be better to have the scripts loaded last, so the footer is the best place. I was also thinking in terms of EP4 flexibility to other modules / plugins. But, as I said, it can be on the header.

Just to be clear, we are talking about the same footer , right ? On easypopulate_4.php

mc12345678 commented 8 years ago

A few years back I had been working on a plugin that worked by loading specific code on each page load. To accomplish this the calling code was added to the ZC footer file because every "properly" formatted page would be expected to load that file. Later instead of a specific line/series of lines of code transitioned to a notifier... Well, requested that notifier to be added, but because of the code's functionality it was identified that there was really no need to load the code by reference to the template/user displayed code. Therefore the request for the notifier was denied.

So yes we are in a way referring to the EP4 footer... The page loads once per click. I thought that the JS. Could be loaded asyncronously and not necessarily effect the remaining page load...

mesnitu commented 8 years ago

Ok, so in the header it is

mesnitu commented 8 years ago

It's done on commit/3ca73f6c528e8b4d188e503caa9ab5fc52fca6c1