How? Add some info text to a certain page?

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

How? Add some info text to a certain page?

Post by onoehring » 2019-06-25 16:13

Hi,

I have created a setting that the admin can change. I want to display that setting (grabbing it by php and SQL from the database) on a certain page.
Is there a way to position some informational text below the title? Or as a footer under the data display (also: under the details to master record near the bottom of a page)?

I marked some possible placed in the image:
ec45.png
ec45.png (164.13 KiB) Viewed 3261 times
Olaf

pbottcher
AppGini Super Hero
AppGini Super Hero
Posts: 1638
Joined: 2018-04-01 10:12

Re: How? Add some info text to a certain page?

Post by pbottcher » 2019-06-25 21:48

Hi,

for the header you could try to put into the hooks/TALBENAME.php file into the TABLENAME_footer function

Code: Select all

		$footer='<script>if ($j(".page-header .row div:first button").length)  { 
							$j("<a> MYTEXT</a>").insertAfter(".page-header button"); 
						}
						else { 
							$j(".page-header a").append("<a> MYTEXT</a>");
						}
					</script>';
				break;
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.

User avatar
onoehring
AppGini Super Hero
AppGini Super Hero
Posts: 1163
Joined: 2019-05-21 22:42
Location: Germany
Contact:

Re: How? Add some info text to a certain page?

Post by onoehring » 2019-06-26 06:52

Hi pbötcher,

thanks for that code, but when I put something in the _footer section, it overwrites the general /hooks/footer-extras.php (where I have placed a general application footer). Do I need to write an extra php-include in the _footer section as well, adding to your code?

Olaf

User avatar
onoehring
AppGini Super Hero
AppGini Super Hero
Posts: 1163
Joined: 2019-05-21 22:42
Location: Germany
Contact:

Re: How? Add some info text to a certain page?

Post by onoehring » 2019-06-26 07:02

Hi again,
sorry, solved myself by rtfm: Simply add <%%FOOTER%%> to your return value ...

Code: Select all

$footer='<script>if ($j(".page-header .row div:first button").length)  { 
							$j("<a> MYTEXT</a>").insertAfter(".page-header button"); 
						}
						else { 
							$j(".page-header a").append("<a> MYTEXT</a>");
						}
					</script><%%FOOTER%%>';
Does the trick.
Olaf

pbottcher
AppGini Super Hero
AppGini Super Hero
Posts: 1638
Joined: 2018-04-01 10:12

Re: How? Add some info text to a certain page?

Post by pbottcher » 2019-06-26 07:10

Yep, that helps :-)
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.

User avatar
onoehring
AppGini Super Hero
AppGini Super Hero
Posts: 1163
Joined: 2019-05-21 22:42
Location: Germany
Contact:

Re: How? Add some info text to a certain page?

Post by onoehring » 2019-06-26 08:12

Hi pbötcher,

just to let you know, your code

Code: Select all

($j(".page-header .row div:first button").length)  { 
							$j("<a> MYTEXT</a>").insertAfter(".page-header button"); 
						}
does not seem to work (but the next $j... does - (and that seems good enough for me at this time).

Olaf

pbottcher
AppGini Super Hero
AppGini Super Hero
Posts: 1638
Joined: 2018-04-01 10:12

Re: How? Add some info text to a certain page?

Post by pbottcher » 2019-06-26 08:54

Hi,

what does not work? In which case. In my test environment it works just fine.
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.

User avatar
onoehring
AppGini Super Hero
AppGini Super Hero
Posts: 1163
Joined: 2019-05-21 22:42
Location: Germany
Contact:

Re: How? Add some info text to a certain page?

Post by onoehring » 2019-06-26 09:45

Hi,

it simply does not show "mytext" - it seems the else is taken always.
I admit, not investigating further as the else condition is - it seems - what I would always want.

But right now I am posting another jquery question that is related to this: viewtopic.php?f=2&t=3104

Olaf

pbottcher
AppGini Super Hero
AppGini Super Hero
Posts: 1638
Joined: 2018-04-01 10:12

Re: How? Add some info text to a certain page?

Post by pbottcher » 2019-06-27 06:27

Hi,

I think the code itself works fine, but is for one setting. As you can have different settings, who you page is displayed (which I do not know) you may of course need to adjust the code to your needs.
This code assumes that you have a combined TV/DV and that you may or may not have the button at the top (next to the header) to add new records.
If e.g. you do not have the button there, of course you will always run through the else path
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.

User avatar
onoehring
AppGini Super Hero
AppGini Super Hero
Posts: 1163
Joined: 2019-05-21 22:42
Location: Germany
Contact:

Re: How? Add some info text to a certain page?

Post by onoehring » 2019-06-27 07:20

Hi pbötcher,

thank you for your explanation. I found a solution with Jan's help that works quite well for me (and maybe others): viewtopic.php?f=2&t=3104&p=10381#p10381

Olaf

Post Reply