This topic is locked
[SOLVED]

 Master Menu on header.php

1/13/2008 3:28:02 PM
PHPRunner General questions
A
acpan author

Hi,
As i have embeded submenus in some of the Add/Edit pages,

each time there is a manual change or recompilation,

i have to search all pages with embeded submenu modifications

and re-do the modifitaion again this is getting very very tedious.

I spend 60% of my time trying to locate the codes each time

there is changes. I have 5 main entries generated by phprunner,

and around 20 submenu entries using embeded menu codes.
So i decided not to create any menu using phprunner and rely

on a single external script which will be a master menu that links

to any pages i want.
I place the menu script in header.php and and copy the relevant files

downloaded from dynamic drive website. Now my master menu

can be accessible by any pages at anytime. Just a single file to maintain

for the menus i have.
This look better now and i am happy

that if this work, i no longer need to maintain the submenu codes in the

phprunner generated pages.
Below is my complete header.php code simpliefied with a few menu entires,

which already work. What i did is replace the header.php with this one below

and remove all menu items in phprunner and generate pages. It works.
The problem is, the menu is visible when the user is at the login screen.

I need a way to turn off the menu when user is not logged in and turn on

when he is in. There should be an if else within the header.php to hide and show

the menu section like this but it does not work, i think syntax is wrong or phprunner variables

is not right, i tried this below but not working:
IF $_SESSION["UserID"] > 0

{

<li><a href="1_list.php" title="Account" rel="dropmenu1_a"><span>Account</span></a></li>

<li><a href="2_list.php" title="Service Centre" rel="dropmenu2_a"><span>Service Center</span></a></li>

<li><a href="3_list.php" title="Phonebook" rel="dropmenu3_a"><span>Phonebook</span></a></li>

}
Please kindly advise.
--- my complete header.php ---
<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>Slashdot's Menu</title>
&lt;script type="text/javascript" src="dropdowntabfiles/dropdowntabs.js">
/***

  • Drop Down Tabs Menu- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
  • This notice MUST stay intact for legal use
  • Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code

    /
    </script>

    <literal>

    <link rel="stylesheet" type="text/css" href="sdmenu/sdmenu.css" />

    &lt;script type="text/javascript" src="sdmenu/sdmenu.js">

    /

  • Slashdot Menu script- By DimX
  • Submitted to Dynamic Drive DHTML code library: http://www.dynamicdrive.com
  • Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code

    ***/

    </script>

    &lt;script type="text/javascript">

    // <![CDATA[

    var myMenu;

    window.onload = function() {

    myMenu = new SDMenu("my_menu");

    myMenu.init(); };

    // ]]>

    </script>

    </li>

    </head>
    <body>

    <form action="#" style="font-family: sans-serif; font-size: .8em" onsubmit="return false">

    </form>
    <!-- CSS for Drop Down Tabs Menu #1 -->

    <link rel="stylesheet" type="text/css" href="dropdowntabfiles/ddcolortabs.css" />

    <body>

    <div id="colortab" class="ddcolortabs">

    <ul>

    <li><a href="1_list.php" title="Account" rel="dropmenu1_a"><span>Account</span></a></li>

    <li><a href="2_list.php" title="Service Centre" rel="dropmenu2_a"><span>Service Center</span></a></li>

    <li><a href="3_list.php" title="Phonebook" rel="dropmenu3_a"><span>Phonebook</span></a></li>

    </ul>

    </div>
    <div class="ddcolortabsline">&nbsp;</div>
    <!--1st drop down menu -->
    <div id="dropmenu1_a" class="dropmenudiv_a">

    <a href="1_1_list.php">Account</a>
    </div>
    <!--2nd drop down menu -->

    <div id="dropmenu2_a" class="dropmenudiv_a" style="width: 150px;">

    <a href="2_1_list.php">News</a>

    </div>
    <!--3rd drop down menu -->

    <div id="dropmenu3_a" class="dropmenudiv_a" style="width: 150px;">

    <a href="3_1_list.php">Phonebook</a>

    </div>
    <script type="text/javascript">

    //SYNTAX: tabdropdown.init("menu_id", [integer OR "auto"])

    tabdropdown.init("colortab", 3)

    </script>
    </body>

    </html>

J
Jane 1/14/2008

Hi,
here is a sample:

<?php

if ($_SESSION["UserID"]!="Guest")

{

?>

<li><a href="1_list.php" title="Account" rel="dropmenu1_a"><span>Account</span></a></li>

<li><a href="2_list.php" title="Service Centre" rel="dropmenu2_a"><span>Service Center</span></a></li>

<li><a href="3_list.php" title="Phonebook" rel="dropmenu3_a"><span>Phonebook</span></a></li>

<?php

}?>

A
acpan author 1/14/2008

Hi Jane, thanks for your help. it works, wonderful!

This is a good work around to have a seperate menu system in one file.

Dex

hichem 1/17/2009

Hi Jane, thanks for your help. it works, wonderful!

This is a good work around to have a seperate menu system in one file.

Dex


It would be nice to see the next PHPR release managing menus and submenus through an additional table for example that would have an access mask defining what menu elements each user has access to.

Also some built in DHTML menu layouts as part of the header or integrated into PHPR would be great.
It looks like the next release will have some new features to handle menus so looking fwd to seeing what's coming, judging by the quality of PHPRunner, we can only expect the best <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=36902&image=1&table=forumreplies' class='bbc_emoticon' alt=':)' />

Admin 1/18/2009

Hich,
this feature is already there - check User Group Permissions.

hichem 1/18/2009

Hich,

this feature is already there - check User Group Permissions.


Thansk Sergey

In the user group permissions I don't see the admin pages?
When I login as guest I stil see the Admin area link despite not being able to open that link.
I checked on my ugrights table and don't see any entry for admin rights and a groupID of -3. (only have an entry for GroupID -1 which am assuming corresponds to the Admin access group and -3 corresponds to Guest?) SO by deafult Guest does not see the admin pags but still sees the link (admin area), so management menu access to menu items seems only to work when there is a 1 to 1 relationship between link and page (admin area has 3 pages or tabs)
I have created a new Access group and this AG can still see the admin area menu upon login (although cannot access it).
Is it possible to get the admin pages also listed to grant access to these through the admin area to other access groups? Say for example I want to have an AG called SuperUsers and allow this AG to only see the 'Assign Users to Groups' tab. How can this be done?
Hope the next release will allow a better manipulation of menus/submenus <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=36915&image=1&table=forumreplies' class='bbc_emoticon' alt=':)' />
many thanks in advance

J
Jane 1/20/2009

Hi,
Please publish your project on Demo Account and open a ticket at http://support.xlinesoft.com sending a URL to your pages along with instructions on reproducing this error.

M
MikeB941 4/4/2009

PHPRUNNER 5.0 Build 766
Just a quick note on the sample code - if login as guest is NOT allowed - the $_SESSION["UserID"] will be equal to "" so I modified the if statement to:
<?php

if ($_SESSION["UserID"]!="Guest" && $_SESSION["UserID"]!="")

{

?>

<li><a href="1_list.php" title="Account" rel="dropmenu1_a"><span>Account</span></a></li>

<li><a href="2_list.php" title="Service Centre" rel="dropmenu2_a"><span>Service Center</span></a></li>

<li><a href="3_list.php" title="Phonebook" rel="dropmenu3_a"><span>Phonebook</span></a></li>

<?php

}?>

M
MikeB941 4/4/2009

PHPRUNNER 5.0 Build 766
OK, one more wrinkle.
Firefox and Internet Explorere handle cookies differently when it comes to expiring them at the end of the session.
In Internet Explorer, the PHPSESSID cookies for PHPRUNNER projects are expired/deleted WHEN THE PARTICULAR BROWSER WINDOW IS CLOSED.
In Firefox the PHPSESSID cookies for PHPRUNNER projects are NOT expired/deleted until ALL Firefox windows are closed (this has to do with each browser window under Firefox being part of the same base instance).
SO, under Firefox, the PHPSESSID HANGS AROUND (unless you close EVERY Firefox browser window) and the $_SESSION["UserID"] will still contain UserID even after the particular Firefox browser window has been closed and a new one has been opened to log back into the application (again, UNLESS EVERY Firefox browser window has been closed).
SO, to keep the master menu contained in the header.php from appearing on the login page I modified the code to:
<?php

$temp = Explode('/', $_SERVER["SCRIPT_NAME"]);

if ($temp[count($temp) - 1]!="login.php")

{

?>

<li><a href="1_list.php" title="Account" rel="dropmenu1_a"><span>Account</span></a></li>

<li><a href="2_list.php" title="Service Centre" rel="dropmenu2_a"><span>Service Center</span></a></li>

<li><a href="3_list.php" title="Phonebook" rel="dropmenu3_a"><span>Phonebook</span></a></li>

<?php

}?>

</p>