This topic is locked

Free page

10/15/2007 5:53:23 PM
PHPRunner General questions
G
gbhmayer author

How to do a free custom page (without a table) in my system, to make a custom menu (initial page that links anothers pages)?

G
giles 10/16/2007

Hi Gerson,

I've used two approaches to this....

  1. Created a table "submenus" with the fields (all varchar):

    menuname

    link

    Then I use phprunner to create a view of submenus called (e.g.) "Admin" that list all links with menuname="Admin"

    Clicking on the link field in the list takes you to the page you want to display - could be a phprunner page or a totally separate page...
    The disadvantage of this approach is that the standard phprunner security/access does not control what links are displayed although code could be built for this...
  2. Second approach...Created a new view of a table. Doesn't matter what fields are chosen because that page is never displayed. Instead a BeforeShowEdit event redirects to other pages depending on the value of a field in the table.
    function BeforeShowEdit(&$smarty,&$templatefile)

    {

    //** Redirect to another page ****

    global $conn;
    $str = "select field1 from table1 where keyfield=".$_GET["editid1"];

    $rs = db_query($str,$conn);

    $data = db_fetch_array($rs);

    $type = $data["field1"];
    If ($type=="Type1")

    {

    $strpage = "Location: Type1_edit.php?editid1=".$_GET["editid1"];

    header($strpage);

    }

    ElseIf ($type=="Type2")

    {

    $strpage = "Location: Type2_edit.php?editid1=".$_GET["editid1"];

    header($strpage);

    }

    ElseIf ($type=="Type3")

    {

    $strpage = "Location: Type3_edit.php?editid1=".$_GET["editid1"];

    header($strpage);

    }

    Else

    {

    echo "That's not a valid type. FacID=".$_GET["editid1"];

    }

    exit();
    In the above case I want to use one of three different views to edit the data in a record depending on what type of facility (as stored in field1) is involved.
    Don't know whether this helps but may give you some approaches to use....

G
gbhmayer author 10/16/2007

Thank you by solution.