Page 1 of 1

How? Add some info text to a certain page?

Posted: 2019-06-25 16:13
by onoehring
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 4818 times
Olaf

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

Posted: 2019-06-25 21:48
by pbottcher
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;

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

Posted: 2019-06-26 06:52
by onoehring
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

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

Posted: 2019-06-26 07:02
by onoehring
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

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

Posted: 2019-06-26 07:10
by pbottcher
Yep, that helps :-)

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

Posted: 2019-06-26 08:12
by onoehring
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

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

Posted: 2019-06-26 08:54
by pbottcher
Hi,

what does not work? In which case. In my test environment it works just fine.

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

Posted: 2019-06-26 09:45
by onoehring
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

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

Posted: 2019-06-27 06:27
by pbottcher
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

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

Posted: 2019-06-27 07:20
by onoehring
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