How to create special HTML page for Guest users

Discussions related to customizing hooks. Hooks are documented at http://bigprof.com/appgini/help/advanced-topics/hooks/
Post Reply
ndoddi
Posts: 13
Joined: 2020-03-26 18:08

How to create special HTML page for Guest users

Post by ndoddi » 2020-03-27 00:02

Hello,

I want to remove border and title of the table which I defined in below code. I also want to set height of this table. This table will be visible for only anonymous users/ guest users. My objective is to create simple HTML page for the guest users with my business details. Please help me how can I achieve this.

I have used attached code in hooks/links-home.php

Attached images show my code and guest html page requirements
Attachments
2020-03-26 18_26_28-C__xampp_htdocs_AG_orpm_app_hooks_links-home.php - Notepad++.png
2020-03-26 18_26_28-C__xampp_htdocs_AG_orpm_app_hooks_links-home.php - Notepad++.png (26.52 KiB) Viewed 4685 times
guestuserTable1.png
guestuserTable1.png (64.01 KiB) Viewed 4685 times

ndoddi
Posts: 13
Joined: 2020-03-26 18:08

Re: How to create special HTML page for Guest users

Post by ndoddi » 2020-03-27 00:14

My guest user page should look as given in the attached image
Attachments
2020-03-26 19_11_23-Rental Property Manager _ Homepage.png
2020-03-26 19_11_23-Rental Property Manager _ Homepage.png (44.04 KiB) Viewed 4680 times

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

Re: How to create special HTML page for Guest users

Post by pbottcher » 2020-03-28 19:37

Hi,

you can use javascript through the hooks/header-extras.php file to manipulate the DOM to your needs (e.g. $j('.btn.btn-block.btn-lg.btn-info').remove() would remove the title bar). You need to make sure that you only catch the index page for users not logged in the system (this you can verify by checking the memberinfo group for the user calling the site)

As alternative you could also create a custom page and redirect the non-logged in user to that page which gives you more flexibility to my opinion.
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.

ndoddi
Posts: 13
Joined: 2020-03-26 18:08

Re: How to create special HTML page for Guest users

Post by ndoddi » 2020-03-29 20:33

Thanks for your response, my dear Friend.

I did further analysis in the last few days to reach my goal and found solution. For those looking for solution with code, I am giving the solution below. Below code will create the Guest user / Anonymous user HTML page as given in the attached image. You can update and design your own HTML page by updating "$htmlCode1" variable.

<!-- Follow below 3 steps, for Guest HTML page Design -->

<!-- Step1:
Go to Appgini > Set any one table (Ex: "TableA") as, "Hide link in homepage".
Go to "Application Login > Admin Area > Edit anonymous permission".
Set view permission as "owner" for above "TableA" and "Save" -->


<!-- Step2: put below JS code in home.php at the bottom of file, before footer call -->
<script>
var x = document.getElementsByClassName("panel-body-description");
document.getElementById("custom_links").innerHTML = x[0].innerHTML;;
</script>
<?php include_once("$currDir/footer.php"); ?>

<!-- Step3: Put below php code in hooks/links-home.php -->
<?php
$htmlCode1 ='<div style="padding:10px 10px; border:1px solid red">
<p style="padding:10px 10px; border:1px solid green"> <br>A1<br>A<br>A<br>A<br>A5<br>A<br>A<br>A<br>A<br>A10</p>
</div>';

$homeLinks[] = array(
'url' => '',
'title' => '',
'description' => $htmlCode1,
'groups' => array('anonymous')
);
?>
Attachments
2020-03-29 15_36_11-Rental Property Manager _ Homepage.png
2020-03-29 15_36_11-Rental Property Manager _ Homepage.png (78.98 KiB) Viewed 4589 times

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

Re: How to create special HTML page for Guest users

Post by pbottcher » 2020-03-29 21:02

Hi,

glad you found your solution. Just remember that the home.php file will get overwritten once you regenerate your application. So make sure your changes do not get lost.
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.

ndoddi
Posts: 13
Joined: 2020-03-26 18:08

Re: How to create special HTML page for Guest users

Post by ndoddi » 2020-04-01 15:33

pböttcher wrote:
2020-03-29 21:02
Hi,

glad you found your solution. Just remember that the home.php file will get overwritten once you regenerate your application. So make sure your changes do not get lost.
That is correct. Every time you regenerate your project code, "home.php" file will be regenerated. So, you need to redo "Step2" given above.

This forum is a great place to learn. I would like to thank Appgini for setting up this forum. I also like to thank so many friends who are contributing and posting solutions in this forum. I myself learned so much from multiple other posts, in this forum.

User avatar
a.gneady
Site Admin
Posts: 1281
Joined: 2012-09-27 14:46
Contact:

Re: How to create special HTML page for Guest users

Post by a.gneady » 2020-04-02 11:40

ndoddi wrote:
2020-04-01 15:33
That is correct. Every time you regenerate your project code, "home.php" file will be regenerated. So, you need to redo "Step2" given above.

This forum is a great place to learn. I would like to thank Appgini for setting up this forum. I also like to thank so many friends who are contributing and posting solutions in this forum. I myself learned so much from multiple other posts, in this forum.
Thanks @ndoddi :)

If you're using AppGini 5.82, this new feature might be of use:
  • Override default home.php if hooks/home-custom.php exists, allowing creation of advanced custom dashboards.
:idea: AppGini plugins to add more power to your apps:
  • DataTalk is an innovative AppGini plugin based on ChatGPT that allows you to interact with your AppGini database using natural language questions, without writing any SQL. Check the demo video
  • Mass Update plugin: Update multiple records at once and improve your workflow efficiency.
  • Check our other plugins and get a generous discount of up to 30% when buying 2 or more plugins.

ndoddi
Posts: 13
Joined: 2020-03-26 18:08

Re: How to create special HTML page for Guest users

Post by ndoddi » 2020-04-29 18:13

Thanks @ahmed.

"hooks/home-custom.php" is giving me blank page, so that I can design my own dashboards for both guest users and logged-in users. This is a great feature.

But table dropdown menus are missing in the header for the logged-in user, as shown below.
How can I show these menus ?
2020-04-29 13_04_55-Rental Property Manager _.png
2020-04-29 13_04_55-Rental Property Manager _.png (22.16 KiB) Viewed 3863 times

User avatar
a.gneady
Site Admin
Posts: 1281
Joined: 2012-09-27 14:46
Contact:

Re: How to create special HTML page for Guest users

Post by a.gneady » 2020-06-27 15:30

Sorry for the long delay ... these drop-downs don't show in the homepage, so they don't show in the home-custom one as well ... but I'll consider adding an option to override this in future releases.
:idea: AppGini plugins to add more power to your apps:
  • DataTalk is an innovative AppGini plugin based on ChatGPT that allows you to interact with your AppGini database using natural language questions, without writing any SQL. Check the demo video
  • Mass Update plugin: Update multiple records at once and improve your workflow efficiency.
  • Check our other plugins and get a generous discount of up to 30% when buying 2 or more plugins.

ndoddi
Posts: 13
Joined: 2020-03-26 18:08

Re: How to create special HTML page for Guest users

Post by ndoddi » 2020-07-12 20:02

Thanks for the response, Ahmed.

Thanks,
ndoddi

Post Reply