This topic is locked
[SOLVED]

 show number of records in the menu link

3/23/2011 2:24:41 AM
PHPRunner General questions
C
chrisclements author

Can you please post the code from this video that allows you to show the number of records next to the links in the menu. Its at 4:42 in the video, but I can not find it posted in the forum anywhere.
http://xlinesoft.com/tutorials/MenuBuilder.html
Thanks,

Chris

B
bobdansei 3/25/2011



Here it is:

http://xlinesoft.com/blog/2011/01/25/how-to-use-menu-builder-in-phprunnerasprunnerpro/


well this work fine but how can i count only the loged user link?

Sergey Kornilov admin 3/25/2011

Rodrigo,
unfortunately there is no generic solution for this task. Each table that uses advanced security needs to be added to the code manually.
Here is an example:



if($menuItem->getLinkType() == 'Internal')

{

global $tables_data;

$table=$menuItem->getTable();

include_once(getabspath("include/".GetTableURL($table)."_settings.php"));

$table=GetOriginalTableName($table);

$sql="select count(*) as c from " . AddTableWrappers($table);

if ($table=="Cars")

{

$sql.=" where CarsOwnerID=".$_SESSION["_Cars_OwnerID"];

}

else if ($table=="Customers")

{

$sql.=" where CustomersOwnerID=".$_SESSION["_Customers_OwnerID"];

}
$rs=CustomQuery($sql);

$data = db_fetch_array($rs);

$menuItem->setTitle($menuItem->getTitle() . " (". $data["c"] . ")");

}

return true;
B
bobdansei 3/25/2011



Rodrigo,
unfortunately there is no generic solution for this task. Each table that uses advanced security needs to be added to the code manually.
Here is an example:



if($menuItem->getLinkType() == 'Internal')

{

global $tables_data;

$table=$menuItem->getTable();

include_once(getabspath("include/".GetTableURL($table)."_settings.php"));

$table=GetOriginalTableName($table);

$sql="select count(*) as c from " . AddTableWrappers($table);

if ($table=="Cars")

{

$sql.=" where CarsOwnerID=".$_SESSION["_Cars_OwnerID"];

}

else if ($table=="Customers")

{

$sql.=" where CustomersOwnerID=".$_SESSION["_Customers_OwnerID"];

}
$rs=CustomQuery($sql);

$data = db_fetch_array($rs);

$menuItem->setTitle($menuItem->getTitle() . " (". $data["c"] . ")");

}

return true;



well aynway this worked great tnks!!