This topic is locked
[SOLVED]

 Dynamically Created Menu Hyperlink Not Working.

2/22/2013 11:02:24 PM
PHPRunner General questions
C
copper21 author

Hello,
I have created a custom menu item and I got it working great. This menu item dynamically creates sub menus and those sub menus are direct links to a certain list page in my application. This sub menu link includes search parameters as well, for example ...._list.php?q=(fieldname~equals~SOMETHING). For some reason, the sub menu link only takes me to the list page without adding the search parameters. The weird thing is that when I hover over the sub menu item, it shows the correct url: http://server/application/table_list.php?q=(fieldname~equals~SOMETHING), but when I click the sub menu item, it only takes me to the list page: http://server/application/table_list.php. I have access to all of the tables through permissions.
The only thing I changed regarding the sub menu item is the background color of the menu item. Any clues as to why this no longer works? Below is the code I use for the sub menu item:
//Individual's Folders Menu
if ($menuItem->getTitle() == 'myfolder')

{

//Get the names of the categories from the user

global $conn;

$strColName = "SELECT DISTINCT folder_name FROM case_analysis_ir_folders WHERE ps = '".$_SESSION["UserID"]."'";

$resColName = db_query($strColName,$conn);
$menu = "</a>";
while ($title = db_fetch_array($resColName))

{

$menu = $menu."<a href='My_Folder_Data_list.php?q=(folder_name~equals~".$title['folder_name'].")'><b>".$title['folder_name']."</b></a>
";

}
$menuItem->setTitle($menu);

}
Thanks, have a great weekend,
Brian

Sergey Kornilov admin 2/25/2013

While there is not enough info to answer why this is happening I can offer a workaround here:

  1. Create this menu item via Menu Builder. Hide it when necessary using ModifyMenuItem event.
  2. Move your filtering code to BeforeSQLQuery event. Here is an example:

    http://xlinesoft.com/phprunner/docs/modify_sql_query_on_the_fly.htm

C
copper21 author 2/25/2013

Sergey,
Again, I thank you for your help in the matter with such little information. After hours of trying to figure out what the issue was, I discovered that the bold tags were the issue. I removed the bold tags in the code and all worked just fine...I guess that leaves me wondering why the bold tags created the problem.
Thanks again for your help!
Brian