Display count of filtered results on homepage

Discussions related to customizing hooks. Hooks are documented at http://bigprof.com/appgini/help/advanced-topics/hooks/
Post Reply
kgeorge
Posts: 2
Joined: 2020-02-16 16:14

Display count of filtered results on homepage

Post by kgeorge » 2020-03-01 00:57

Greetings!

I have an AppGini project that I am working on for a client. I seem to understand the basics of it pretty well I think and also have done limited work in PHP / Java in the past. I need some assistance on a couple of fairly minor issues currently as well as someone I can use on an as needed basis moving forward.

My immediate need requires the placement of the count of the results from a filtered URL on the homepage, preferably in the header next to the name given to additional links I set up in the links-home.php file. If not there then in the description portion of those links.

I think I basically need a SELECT Count query with where the EQUALS value changes for each of the links. Then I would need to know how to place those results in either the header or description of the link.

I am hoping to get some help on how to write the query so it is valid in the links-home.php file and where I need to place each of the pieces of code within that file. For example, should the code go between the $homeLinks[] sections of code?

Assistance will be greatly apppreciated!!

Kent

Alisson
Veteran Member
Posts: 81
Joined: 2017-02-25 20:32

Re: Display count of filtered results on homepage

Post by Alisson » 2020-03-07 20:27

Hi, Try this in your links-home.php file:

Code: Select all

$total =  sqlValue("SELECT count(*) FROM yourtable");

$homeLinks[] = array(
	'url' => 'your filtered URL here', 
	'title' => 'Your Tile Here''.'<span class="badge badge-light">'.$total.'</span>',
	'description' => '',
	'groups' => array('*'), 
	'grid_column_classes' => 'col-md-3', 
	'panel_classes' => 'panel-success',
	'link_classes' => 'btn-success',
	'icon' => 'resources/table_icons/car.png',
	'table_group' => 'Admins'
	);

Post Reply