Hi,
I'm creating a custom page, located in "hooks/my_custom_page.php"
Since my custom page is under hooks, the link to appGini Helper src: "hooks/AppGiniHelper.min.js" defined in header_extras.php is not working, showing a 404 error.
I know that's because it looks under hooks/hooks, since the page is already in hooks.
How could I modify the src in header_extras.php to handle pages located in hooks as well as all the other pages?
Thanks,
Error 404 in custom pages
Re: Error 404 in custom pages
(1) Starting from the specs for custom pages here, https://bigprof.com/appgini/help/advanc ... cess-pages, you have to define a constant named PREPEND_PATH:
You can use that constant in hooks/header-extras.php, too:
Code: Select all
<?php
// file: hooks/YOURCUSTOMPAGE.php
define('PREPEND_PATH', '../');
// ...
Code: Select all
<!-- file: hooks/header-extras.php -->
<script src="<?=PREPEND_PATH?>hooks/AppGiniHelper.min.js"></script>
Kind regards,
<js />
My AppGini Blog:
https://appgini.bizzworxx.de/blog
You can help us helping you:
Please always put code fragments inside
AppGini 24.10 Revision 1579 + all AppGini Helper tools
<js />
My AppGini Blog:
https://appgini.bizzworxx.de/blog
You can help us helping you:
Please always put code fragments inside
[code]...[/code]
blocks for better readabilityAppGini 24.10 Revision 1579 + all AppGini Helper tools
Re: Error 404 in custom pages
(2) You can reference the fully qualified url, for example:
Please note
Alternative (1) is more dynamic and more flexible
Alternative (2) is shorter, but you will have to change the url when moving your app into a different location, for example after deployment to your remote server
Code: Select all
<!-- file: hooks/header-extras.php -->
<script src="http://localhost/PATH/TO/YOUR/APP/hooks/AppGiniHelper.min.js"></script>
Alternative (1) is more dynamic and more flexible
Alternative (2) is shorter, but you will have to change the url when moving your app into a different location, for example after deployment to your remote server
Kind regards,
<js />
My AppGini Blog:
https://appgini.bizzworxx.de/blog
You can help us helping you:
Please always put code fragments inside
AppGini 24.10 Revision 1579 + all AppGini Helper tools
<js />
My AppGini Blog:
https://appgini.bizzworxx.de/blog
You can help us helping you:
Please always put code fragments inside
[code]...[/code]
blocks for better readabilityAppGini 24.10 Revision 1579 + all AppGini Helper tools
Re: Error 404 in custom pages
Thank you so much.
I'll try the PREPEND_PATH, I don't know how I missed that....
I'll try the PREPEND_PATH, I don't know how I missed that....
SOLVED: Error 404 in custom pages
Great!
By the way: when I started writing custom pages I saved them in hooks subdirectory. For a while now I am storing them in main directory instead of hooks directory and this works pretty well and I avoid trouble with paths. I know it's not the way the docs recommend. But I have made some good experiences.
Regards,
Jan
By the way: when I started writing custom pages I saved them in hooks subdirectory. For a while now I am storing them in main directory instead of hooks directory and this works pretty well and I avoid trouble with paths. I know it's not the way the docs recommend. But I have made some good experiences.
Regards,
Jan
Kind regards,
<js />
My AppGini Blog:
https://appgini.bizzworxx.de/blog
You can help us helping you:
Please always put code fragments inside
AppGini 24.10 Revision 1579 + all AppGini Helper tools
<js />
My AppGini Blog:
https://appgini.bizzworxx.de/blog
You can help us helping you:
Please always put code fragments inside
[code]...[/code]
blocks for better readabilityAppGini 24.10 Revision 1579 + all AppGini Helper tools