Build a new menu (customize themes)

From PGVWiki
Jump to navigation Jump to search

add a new menu

You will find the concerning PHP-code in the file "header.php".
Because every theme has his own menu-system, we will show you the essential changes as an example for the theme "Cloudy".
The "header.php" for "Cloudy" you will find in the following path:

/phpGedView/themes/cloudy/header.php

Open the file with a text-editor or with a html-editor.
Search for the first entry like:

$my_temp_menu= array();

The following lines build the first menu-point in PGV, showed with the "Home"-icon.

All the stuff from this Home-menu (plus his submenus) is enclosed between "" and "" -tags.
Every next "" ... "" -bock encloses such a menu-icons with the concerning submenus.
A douzen menu-items are enclosed in a "

" ... "

" -tag.

In this table look for a code like this (for example the "charts"-menu):

            $menu = array();
            $menu["label"] = $pgv_lang["charts"];
            $menu["labelpos"] = "none";
            $menu["icon"] = $PGV_IMAGE_DIR."/".$PGV_IMAGES["pedigree"]["large"];
        if (file_exists("pedigree.php")) $menu["link"] = "pedigree.php";
            $menu["class"] = "menuitem";
            $menu["hoverclass"] = "menuitem_hover";
            $menu["flyout"] = "down";
            $menu["submenuclass"] = "submenu$ff";
            $menu["items"] = array();

        if (file_exists("pedigree.php")) {
            $submenu = array();
            $submenu["label"] = $pgv_lang["pedigree_chart"];
            $submenu["labelpos"] = "right";
            $submenu["icon"] = $PGV_IMAGE_DIR."/".$PGV_IMAGES["pedigree"]["small"];
            $submenu["link"] = "pedigree.php";
            $submenu["class"] = "submenuitem$ff";
            $submenu["hoverclass"] = "submenuitem_hover$ff";

With "copy and paste" take this code and put it between two -blocks,

between two othes menu-icons, where you would place your new menu.

Before the copied code write this:

        <?php

Delete the two whole lines beginning with:

        if (file_exists("
                            

and behind the copied code write this:

            print_menu($menu);
        ?>

The result should be this:

        <?php
            $menu = array();
            $menu["label"] = $pgv_lang["charts"];
            $menu["labelpos"] = "none";
            $menu["icon"] = $PGV_IMAGE_DIR."/".$PGV_IMAGES["pedigree"]["large"];
            $menu["class"] = "menuitem";
            $menu["hoverclass"] = "menuitem_hover";
            $menu["flyout"] = "down";
            $menu["submenuclass"] = "submenu$ff";
            $menu["items"] = array();

            $submenu = array();
            $submenu["label"] = $pgv_lang["pedigree_chart"];
            $submenu["labelpos"] = "right";
            $submenu["icon"] = $PGV_IMAGE_DIR."/".$PGV_IMAGES["pedigree"]["small"];
            $submenu["link"] = "pedigree.php";
            $submenu["class"] = "submenuitem$ff";
            $submenu["hoverclass"] = "submenuitem_hover$ff";
            print_menu($menu);
        ?>

Now we learn, how you can change the essental lines for to do what you want to do.
You have the $menu-block, who build the upper-icon you will see on the PGV-page
and the $submenu-block, who build the popup-menu with the submenu-entries on the PGV-page. Find an expressive label for every menu-entry, for example "my Family" and write it like this: $submenu["label"] = "my Family"; Design a new menu-icon with a drawing-program or you will find an existing one by Google.
Store it with a new name for exemple "new-icon.gif" in the following path: /phpGedView/themes/cloudy/images/new-meu.gif and call it in the code like this: $menu["icon"] = "themes/cloudy/images/menue.gif";

Open an External Link

For to open an external link in the same browser-windows:

$submenu["link"] = "http://www.frappr.com";

For to open an external link in a new browser-windows:

$submenu["link"] = "http://www.frappr.com\" target=\"_blank\"";

For to open an external link in a popup-windows:

$submenu["link"] = "????";

build a new HTML-text

Open a HTML-Text

For to open a HTML-text between "header" and "footer":

...until now we don't have any solution for this...

We will need something like this:

$submenu["link"] = "XYZ.php";

and "XYZ.php" should do something like this:

<?php
    print header.php;
    print something.html, useing theme "Cloudy"
    print footer.php;
?>