hook for index.php / homepage?

If you're a new user of AppGini, feel free to ask general usage questions, or look for answers here.
Post Reply
onoehring
AppGini Super Hero
AppGini Super Hero
Posts: 392
Joined: 2019-05-21 22:42
Contact:

hook for index.php / homepage?

Post by onoehring » 2019-10-05 10:35

Hi,

I am using JS to set specific names for some windows of my application using

Code: Select all

window.name = 'myWindowName';
This works fine in regular tables, but how can I do this on the homepage (index.php)?
I place this code in the /hooks/filename-tv.js file.

Why?
I open some links in these specific windows (reusing tabs like I need to) using this HTML

Code: Select all

<a href="somePage" target="myWindowName">blabla</a>
Olaf
Some postings I was involved, you might find useful:
Backup your database (easy) (viewtopic.php?f=4&t=3341); Improve security / safety against DDOS and brute force (failed) logins (viewtopic.php?f=4&t=3168); Field Permissions (hide / lock fields by usergroup) (viewtopic.php?f=4&t=3308); Custom (error) message (viewtopic.php?f=7&t=1740&p=10871#p10906); Audit Log (viewtopic.php?f=4&t=1369&p=10407); Two Factor Authentication (viewtopic.php?f=7&t=3306&p=11478); Add extra (2nd) SAVE CHANGES button (viewtopic.php?f=2&t=3242&p=11104);

peebee
AppGini Super Hero
AppGini Super Hero
Posts: 236
Joined: 2013-03-21 04:37

Re: hook for index.php / homepage?

Post by peebee » 2019-10-08 04:14

/hooks/footer-extras.php is loaded with every page including your homepage. You could call your javascript file from there?

onoehring
AppGini Super Hero
AppGini Super Hero
Posts: 392
Joined: 2019-05-21 22:42
Contact:

Re: hook for index.php / homepage?

Post by onoehring » 2019-10-08 06:27

Hi peebee,

good idea, but I believe in this case it will not work: As you said: footer will be loaded in every page and thus every page will get the title I set there.

Olaf
Some postings I was involved, you might find useful:
Backup your database (easy) (viewtopic.php?f=4&t=3341); Improve security / safety against DDOS and brute force (failed) logins (viewtopic.php?f=4&t=3168); Field Permissions (hide / lock fields by usergroup) (viewtopic.php?f=4&t=3308); Custom (error) message (viewtopic.php?f=7&t=1740&p=10871#p10906); Audit Log (viewtopic.php?f=4&t=1369&p=10407); Two Factor Authentication (viewtopic.php?f=7&t=3306&p=11478); Add extra (2nd) SAVE CHANGES button (viewtopic.php?f=2&t=3242&p=11104);

pböttcher
AppGini Super Hero
AppGini Super Hero
Posts: 680
Joined: 2018-04-01 10:12

Re: hook for index.php / homepage?

Post by pböttcher » 2019-10-08 06:36

Hi,

just check which page is currently loaded and execute your code only when the index page is loaded.

onoehring
AppGini Super Hero
AppGini Super Hero
Posts: 392
Joined: 2019-05-21 22:42
Contact:

Re: hook for index.php / homepage?

Post by onoehring » 2019-10-09 05:20

Hi pbötcher,

someting like peebees idea:
dirty code:
if window.name<>'something' { window.name = 'something'}

Or do you see any other method to check which page is loaded? Maybe phpself and only provide the JS that is needed?

Olaf
Some postings I was involved, you might find useful:
Backup your database (easy) (viewtopic.php?f=4&t=3341); Improve security / safety against DDOS and brute force (failed) logins (viewtopic.php?f=4&t=3168); Field Permissions (hide / lock fields by usergroup) (viewtopic.php?f=4&t=3308); Custom (error) message (viewtopic.php?f=7&t=1740&p=10871#p10906); Audit Log (viewtopic.php?f=4&t=1369&p=10407); Two Factor Authentication (viewtopic.php?f=7&t=3306&p=11478); Add extra (2nd) SAVE CHANGES button (viewtopic.php?f=2&t=3242&p=11104);

pböttcher
AppGini Super Hero
AppGini Super Hero
Posts: 680
Joined: 2018-04-01 10:12

Re: hook for index.php / homepage?

Post by pböttcher » 2019-10-09 18:44

Hi,

almost,

I used some time ago this. You may try it. Or possibly use the new function of 5.8 (which I did not test)

Code: Select all

<?php
$filename=basename($_SERVER['SCRIPT_FILENAME']);
$tablename=substr($filename,0,-4);
// exclude the login page 
if ($tablename == "index" && isset($_SESSION['memberID']) &&  $_SESSION['memberID'] != 'guest') {
?>
<script>
DO WHAT YOU NEED HERE
</script>
<?php 
}

onoehring
AppGini Super Hero
AppGini Super Hero
Posts: 392
Joined: 2019-05-21 22:42
Contact:

Re: hook for index.php / homepage?

Post by onoehring » 2019-10-10 04:46

Hi pbötcher,

nice code. I will try and report back.
Thank you
Olaf
Some postings I was involved, you might find useful:
Backup your database (easy) (viewtopic.php?f=4&t=3341); Improve security / safety against DDOS and brute force (failed) logins (viewtopic.php?f=4&t=3168); Field Permissions (hide / lock fields by usergroup) (viewtopic.php?f=4&t=3308); Custom (error) message (viewtopic.php?f=7&t=1740&p=10871#p10906); Audit Log (viewtopic.php?f=4&t=1369&p=10407); Two Factor Authentication (viewtopic.php?f=7&t=3306&p=11478); Add extra (2nd) SAVE CHANGES button (viewtopic.php?f=2&t=3242&p=11104);

peebee
AppGini Super Hero
AppGini Super Hero
Posts: 236
Joined: 2013-03-21 04:37

Re: hook for index.php / homepage?

Post by peebee » 2019-10-10 07:03

You could also view one of Ahmad's handy video tutorials which will show you how to select the desired page via php and include your javascript.

https://www.youtube.com/watch?v=hBkvdWh-OEw

onoehring
AppGini Super Hero
AppGini Super Hero
Posts: 392
Joined: 2019-05-21 22:42
Contact:

Re: hook for index.php / homepage?

Post by onoehring » 2019-10-10 12:16

Hi peebee,

good idea. Thank you.
Olaf
Some postings I was involved, you might find useful:
Backup your database (easy) (viewtopic.php?f=4&t=3341); Improve security / safety against DDOS and brute force (failed) logins (viewtopic.php?f=4&t=3168); Field Permissions (hide / lock fields by usergroup) (viewtopic.php?f=4&t=3308); Custom (error) message (viewtopic.php?f=7&t=1740&p=10871#p10906); Audit Log (viewtopic.php?f=4&t=1369&p=10407); Two Factor Authentication (viewtopic.php?f=7&t=3306&p=11478); Add extra (2nd) SAVE CHANGES button (viewtopic.php?f=2&t=3242&p=11104);

Post Reply