Hi,
is there a way to automatically read the title of the application from ... somewhere? I would not like to set this by hand, as I want to write some reusable code.
What title am I talking about? This:
In this case I want to receive "Demo" as answer.
Olaf
How to get App Title into PHP variable?
How to get App Title into PHP variable?
Some postings I was involved, you might find useful:
SingleEdit - Prevent concurrent edits on records; Field Permissions; Column-Value-Based-Permissions; Custom (error) message; Audit Log; Backup your database; Two Factor Authentication; Block brute force (failed) logins; Add 2nd SAVE CHANGES button; Place a search on details view
SingleEdit - Prevent concurrent edits on records; Field Permissions; Column-Value-Based-Permissions; Custom (error) message; Audit Log; Backup your database; Two Factor Authentication; Block brute force (failed) logins; Add 2nd SAVE CHANGES button; Place a search on details view
Re: How to get App Title into PHP variable?
Hi Olaf,
you can add the following to the hooks/__global.php file (at the top):
Now you have the $app_name variable.
you can add the following to the hooks/__global.php file (at the top):
Code: Select all
<?php
$f_array=file("$thisDir/../membership_signup.php");
$re = "/(?<=['\"\\(])[^\"()\\n']*?(?=[\\)\"'])/m";
foreach ($f_array as $line_num => $line) {
if (strpos($line,'app_name')) {
preg_match_all($re, $line, $matches);
$app_name=$matches[0][0];
break;
}
}
function login_ok($memberInfo, &$args){
.....
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.
Re: How to get App Title into PHP variable?
Hi pbötcher,
thanks for this code.
I added
after the opening of <?php to set this variable (I guess that was missed). Now, as you have written, I can access $app_name from another file.
Interesting though, that AG defines $app_name in the membership_signup.php file, but not in some application definition file which sets some basic variables, maybe even in the config.php. Wouldn't this be better? Is this woth a feature suggestion/request?
Olaf
thanks for this code.
I added
Code: Select all
$thisDir = dirname(__FILE__);
Interesting though, that AG defines $app_name in the membership_signup.php file, but not in some application definition file which sets some basic variables, maybe even in the config.php. Wouldn't this be better? Is this woth a feature suggestion/request?
Olaf
Some postings I was involved, you might find useful:
SingleEdit - Prevent concurrent edits on records; Field Permissions; Column-Value-Based-Permissions; Custom (error) message; Audit Log; Backup your database; Two Factor Authentication; Block brute force (failed) logins; Add 2nd SAVE CHANGES button; Place a search on details view
SingleEdit - Prevent concurrent edits on records; Field Permissions; Column-Value-Based-Permissions; Custom (error) message; Audit Log; Backup your database; Two Factor Authentication; Block brute force (failed) logins; Add 2nd SAVE CHANGES button; Place a search on details view
Re: How to get App Title into PHP variable?
Hi,
thanks for the correction. Indeed, I missed this statement during copy&paste. If you need the variable more often it makes sense to put it as a feature request. So far, I did not need it yet.
thanks for the correction. Indeed, I missed this statement during copy&paste. If you need the variable more often it makes sense to put it as a feature request. So far, I did not need it yet.
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.