Page 1 of 1
[SOLVED] AppGiniCommon setImage fails on custom page
Posted: 2019-12-13 11:23
by onoehring
Hi Jan,
I am not sure, if it's a AG Helper problem or some other (old?) jquery problem - or some problem with my code. In the latter case I would not know what I did wrong, as there is no concole error pointing to my code.
Please see the attached image 1: The application icon
is changed, even on a custom page (like I would expect it to).Â

- Zwischenablage04c2b.png (64.94 KiB) Viewed 11316 times
Now, I created a new custom page where the AG Helper does not change the image automatically - but when I copy the following code to the console - the icon
is changed. On this custom page I am using the library from momentjs.com that comes with AG ans which is included by default as it seems, to do some date calculations.
Code: Select all
var url="/someimage.png"
new AppGiniCommon()
.setTitle("<b>MyAppTitle</b>")
.setImage(url);Â
Custom page with problem:

- Zwischenablage04.png (71.64 KiB) Viewed 11316 times
The AGHelper is referenced in the /hooks/header-extras.php like this:
Code: Select all
<script src="hooks/AppGiniHelper.min.js"></script>
<script>
//appgini helper
//Adjust application image and title
var url="/someimage.png"
new AppGiniCommon()
.setTitle("<b>MyAppTitle</b>")
.setImage(url);Â
</script>
Any suggestions?
Olaf
Re: AppGiniCommon setImage fails on custom page
Posted: 2019-12-13 16:22
by G Belgrado
I have the same console error in common.js.php
both with helper plugin and without
AppGini.currentTableName: Could not retrieve table name from page URL common.js.php:1394:3
Re: AppGiniCommon setImage fails on custom page
Posted: 2019-12-13 16:35
by onoehring
Hi G Belgrado,
I believe the "AppGini.currentTableName: Could not retrieve table name from page URL common.js.php:1394:3" is because it's a custom page where AG's method of determining the table name simply does not work. I think this is a message not connected to the Helper.
Olaf
SOLVED: AppGiniCommon setImage fails on custom page
Posted: 2019-12-15 12:13
by jsetzer
Sorry, for late response, I somehow missed this post.
- The error message for currentTableName is related to core AppGini, NOT to AG Helper JS Library.
As G Belgrado has already mentioned: This error comes from common.js.php which is an core AppGini script.
- Also the warnings coming from scriptaculous.js are NOT related to AG Helper JS Script, as we do not use scriptaculous.js.
- Also the warnings coming from analyser.js are NOT related to AG Helper JS Script, as we do not use analyser.js.
Some time ago I was facing similar problems in Chrome - not only in AG apps. I have found out that some Chrome Extensions caused warnings and errors in Console. Whenever you are facing such problems,
I recommend checking the same page without Chrome Extensions OR in a different browser like Firefox.
I am going to submit a second post in a couple of minutes concerning custom pages as a response to Olaf's post.
Best,
Jan
SOLVED: AppGiniCommon setImage on custom pages
Posted: 2019-12-15 12:45
by jsetzer
Hi again,
it has been written that there were problems in AppGiniHelper's
.setImage()-function in custom pages.
I can NOT confirm this. The setimage() function works as expected!
I have just double checked it by creating a completely new custom page according to AppGini's specification here:
https://bigprof.com/appgini/help/advanc ... cess-pages

- chrome_GCTc9hiQEw.png (18.96 KiB) Viewed 11271 times
Code: Select all
<?php
define('PREPEND_PATH', '../');
$hooks_dir = dirname(__FILE__);
include("$hooks_dir/../defaultLang.php");
include("$hooks_dir/../language.php");
include("$hooks_dir/../lib.php");
include_once("$hooks_dir/../header.php");
?>
<div class="container">
<h1>Test</h1>
</div>
<script>
new AppGiniCommon()
.setTitle("Test")
// .setIcon("cog") // worxx fine
.setImage("/app/calxx/images/accept.png"); // worxx fine
</script>
<?php
include_once("$hooks_dir/../footer.php");
?>
As long as you pass a valid url refering an existing and reachable image this will work perfectly fine.
I'm sorry, guys, for the irritation.
Best,
Jan
@Olaf: As written on October 5th, you have to specify a
valid (!) image url which is reachable by the server from the location of your custom-page in hooks-subdirectory. If you, for example, specify
/ECoMo.png or
/someimage.png, the server will try to find it in root-directory. Also always double check letter-casing, especially in non-Windows systems. If the problem re-occurs in your environment, please re-check the url.
Re: AppGiniCommon setImage fails on custom page
Posted: 2019-12-16 07:59
by onoehring
Hi Jan,
thanks for your reply. I am trying to fix it ... will report back.
Short: It works, if I run the code that I can see in the debugger again in the console.
Olaf
Re: AppGiniCommon setImage fails on custom page
Posted: 2019-12-17 07:58
by jsetzer
Hi Olaf,
did you try with a valid url?
From your screenshots I can still see /ECoMo.png.
Best,
Jan
Re: AppGiniCommon setImage fails on custom page
Posted: 2019-12-17 08:01
by onoehring
Hi Jan,
yes, I placed the main logo in the root dir, so /ECoMo.png is indeed the correct name and path.
I can of course add some domain to it as well...
But/And this code works on other pages.
Olaf
Re: AppGiniCommon setImage fails on custom page
Posted: 2019-12-17 08:02
by jsetzer
Hi Olaf,
yes, please.
Jan
PS: Documentation for .setImage() function here:
https://appgini.bizzworxx.de/products/j ... t-picture/
Code: Select all
var url="https://www.bizzworxx.de/agh32.png";
new AppGiniCommon()
.setTitle("<b>CLINIC</b>Management")
.setImage(url);
Re: AppGiniCommon setImage fails on custom page
Posted: 2019-12-17 08:08
by jsetzer
onoehring wrote: ↑2019-12-17 08:01
But/And this code works on other pages.
Yes, and that's the reason why we need a
valid (absolute)
URL and not a path.
Referencing resources in most cases depends on the starting-location.
Re: AppGiniCommon setImage fails on custom page
Posted: 2019-12-17 08:11
by onoehring
Hi Jan,
I will try - but it
fails.

- Zwischenablage06b.png (31.51 KiB) Viewed 11224 times
Running the code in the console
works.

- Zwischenablage06.png (47.1 KiB) Viewed 11224 times
My edit above: The /ECoMo.png works on other pages.
My suspicion is, that it has something to do with the JS errors from other parts of that specific page. These seem to occur from using another datepicker (so far I was unable to get the standard AG supplied to work. As this is a custom page, I also failed to use the Helper's date picker (I need something like you described das date-range-picker of your helper here
viewtopic.php?f=13&t=3331&sid=294c89ea0 ... f0b#p11660 )
Olaf
Re: AppGiniCommon setImage fails on custom page
Posted: 2019-12-17 08:47
by onoehring
Hi Jan,
for now I am using a workaround. I simply added
Code: Select all
<script>
//set image again once document is ready
$(function() {
var url = "/ECoMo.png"
new AppGiniCommon()
.setTitle("<b>ECoMo</b>")
.setImage(url);
});
</script>
to the bottom of my page (again, as it is done in the header-extras already). This places the correct icon.
Thanks
Olaf