I just rolled out the upgrade from v2021 to v2022 to my users
Now the drop-down menus etc aren’t populating without them forcing refresh with CTRL + F5
Is there a way to force the refresh globally for everyone?
You may customize the template or creating your own Extension in order to add the version for the Javascript and Css file declaration.
Create an extension file i.e. reload.xml, containing:
<?xml version="1.0"?>
<ew-extension name="Reload" type="Reload" author="My Extension">
<project>
<database>
<table>
</table>
</database>
</project>
<control id="layout" type="simple" ofile="views/layout" oext="php" ifiles="layout.php"/>
</ew-extension>
…then create a “layout.php” file containing:
<# args.code = args.code.replace(/(^.*\$basePath.\?>)(.*)(<\?= )(.*\))(.\?>)/gm, '$1$2$3$4 . "?" . filemtime($RELATIVE_PATH . "$2" . $4)$5'); #>
<# args.code = args.code.replace(/(^.*\$basePath)(.\?>)(.*\.css)(">)/gm, '$1$2$3?<?= filemtime($RELATIVE_PATH . "$3") ?>$4'); #>
<# args.code = args.code.replace(/^(.*)( |h\()(ew\.PATH.*)(".*css)(.*)$/gm, '$1$2$3$4?<?= filemtime($RELATIVE_PATH . $4") ?>$5'); #>
Enabling the extension will add a timestamp query to CSS files and force them to reload whenever they get updated.
Need some help with this as I’ve never created an extension before - where do I put the reload.xml and layout.php files in v2022?according to manual:
extensions folder - The user extensions folder under the PHPMaker folder, e.g. C:\Users<user>\AppData\Roaming\PHPMaker\extensionsthis folder doesn’t exist, do i just make it? and do i make a subfolder named reload that contains the files?
I tried making the folder and dropping those files into it, both with and without a subfolder.
The extension doesn’t show up in phpmaker extensions
You may refer to the existing built-in extension, for example FixedHeaderTable. You may see it from this following folder: C:\Users\user\AppData\Roaming\PHPMaker2022\node_modules@phpmaker\fixedheadertable
But that’s a node module. Does this mean that the method described in the manual using %AppData%\PHPMaker2022\extensions is no longer in use?In %AppData%\PHPMaker2022\node_modules@phpmaker\fixedheadertable there seem to be way more files than just the xml and php filkes that Adam mentioned
I have no idea where to start wih that…
Please always documentation for more info and your reference.You may also read Making Extensions topic from the documentation for info in more detail. It’s not difficult. If you follow the documentation, including do some trial and error based on the existing Extension, I am really sure you will be able to create your own Extension.
Create a “reload” folder within “extensions” i.e. C:\Users\User\AppData\Roaming\PHPMaker2022\extensions\reloadPut reload.xml and layout.php in that sub-folder and it should show up in the list of extensions
In addition, you should also include the package.json, README.md, LICENSE.md, index.js files inside that reload sub-folder.mobhar wrote:
Read > Making Extensions > topic from the documentation for info in more detail.
Good catch, mobhar …I completely forgot to mention those files
How to adopt this for version 2020? When I put the files in the C:\Users<user>\AppData\Roaming\PHPMaker\extensions it is not detected. I have to put the xml file in the C:\Program Files\PHPMaker 2020\extensions for it to be seen in the extensions menu (and I leave the layout.php files in both locations to be safe). But when I enable it and generate it doesn’t seem to work. Is it supposed to copy the layout.php files into the htdocs/www files or something? How will I know when it works? Thanks.
There is no layout.php file in PHPMaker 2020 template file. You need to refer to header.php and footer.php template files if you want to create Extension that will modify the code for such case.
Ahhh i see. thanks. Not to be a pest but how can I confirm that extension was applied? Am I supposed to see new code in the header.php/layout.php? I’m trying to understand the code but I’m not grasping it. I was assuming that everytime a page loads the code will get the timestamp of each css file and append it back to the header.php/layout.php file? Where can I go source code wise to verify? Sorry for the bump. Thanks
It actually depends on how you will modify the code in your header.php and/or footer.php template files. If you add a new section or a new string in that template file that will be displayed in all pages via your Extension, and it actually displays correctly, then that means your Extension is working properly.