Here's How To Dynamically alter the TableTitle

Got something cool to share with AppGini users? Feel free to post it here!
Post Reply
primitive_man
AppGini Super Hero
AppGini Super Hero
Posts: 54
Joined: 2014-03-09 20:20

Here's How To Dynamically alter the TableTitle

Post by primitive_man » 2014-07-23 09:13

If, like me, you'd prefer to have a dynamic Table Title - One that changes to describe the View (Customer List, Customer Details, Print Preview etc) - Here's how to implement it.

1. In the incCommon.php file (found at the root of the app) add the following function (Courtesy of a.gneady):

Add the function at the very bottom of the file.

Code: Select all

#########################################################	
function get_current_view(){
$view = 'TV';
if($_REQUEST['Print_x'] != '' || $_REQUEST['PrintTV'] != '')
$view = 'TVP';
elseif($_REQUEST['dvprint_x'] != '' || $_REQUEST['PrintDV'] != '')
$view = 'DVP';
elseif($_REQUEST['Filter_x'] != '')
$view = 'Filters';
elseif(($_REQUEST['SelectedID'] && !$_REQUEST['deselect_x'] && !$_REQUEST['delete_x']) || 
$_REQUEST['addNew_x'] != '')
$view = 'DV';
return $view;
}
#########################################################
Explanation:
Returned value from get_current_view():

e.g. $vew = get_current_view();
$vew would equal =
'TV' = table view
'TVP': print preview of table view
'DVP': print preview of detail view
'Filters': filters!
'DV': detail view

Depending upon your current View.

2. In the hooks folder, locate your table name hook (e.g. customers.php).
Add the following to the tablename_init() function at the top - e.g. customers_init

Code: Select all

	$v = get_current_view();
	if($v=='DV'){
		$options->TableTitle='Customer Details';
	}
so that the function now reads:

Code: Select all

function customer_init(&$options, $memberInfo, &$args){
	$v = get_current_view();
	if($v=='DV'){
		$options->TableTitle='Customer Details';
	}
	return TRUE;

	}

KSan
AppGini Super Hero
AppGini Super Hero
Posts: 252
Joined: 2013-01-08 20:17

Re: Here's How To Dynamically alter the TableTitle

Post by KSan » 2014-07-23 17:46

Thanks for sharing. This is a great tweak.

Post Reply