Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 536677
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T09:50:49+00:00 2026-05-13T09:50:49+00:00

I have a database driven navigation mainly composed of two tables: menus and a

  • 0

I have a database driven navigation mainly composed of two tables: menus and a menu_items, this works out fine for purely “static” links but now I need to have a dynamic link ( login/logout ).

My menu_items table is just composed of links to pages manually added in the admin. So now I need to adjust the table and model possibly such that it can handle “dynamic” links.

Here’s the schema for the menu_items table:

CREATE TABLE `menu_items` (
  `id` int(11) NOT NULL auto_increment,
  `menu_id` int(11) default NULL,
  `label` varchar(250) default NULL,
  `page_id` int(11) default NULL,
  `link` varchar(250) default NULL,
  `position` int(11) default NULL,
  PRIMARY KEY  (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=18 DEFAULT CHARSET=utf8

Menu id corresponds to another table, so 1 for example is the primary nav, 2 can be utility nav. Position refers to the order relative to each menu in which the menu item is displayed. Link is just a field, eg ‘/user/login’.

I’m looping through each of my menus and creating Navigation containers and using Zend Navigation for this.

Here’s logic I’m using for my login area, I’ll need to move this over and incorporate it into the dynamic navigation:

<?php if($this->identity == null) { ?>
    <p><a href='/user/login'>Login</a></p>
<?php }else{ ?>
    <p>Welcome back <?php echo $this->identity->first_name;?></p>
    <p>To log out <a href='/user/logout'>click here</a></p>
<?php } ?>

It looks like I need to add a new column for access level for each of the menu items, then update my Menu model to account for whether the user is logged in or not and query the menu item’s new access column value, or something along those lines. Anyone have any suggestions?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T09:50:50+00:00Added an answer on May 13, 2026 at 9:50 am

    Gordon’s ACL is the way to go (and I upvoted it). I just wanted to pipe in and describe exactly what I do.

    I created both the sign in and sign out pages in my navigation config:

        <user_signin>
          <label>Sign in</label>
          <other_stuff></other_stuff>
          <resource>mvc:user_signin</resource>
          <privilege>navigate</privilege>
        </user_signin>
    
        <user_signout>
          <label>Sign out</label>
          <other_stuff></other_stuff>
          <resource>mvc:user_signout</resource>
          <privilege>navigate</privilege>
        </user_signout>
    

    Then, in my ACL:

    // 'mvc:home' is wide open, 'user' role inherits from 'guest'
    $this->addResource(new Zend_Acl_Resource('mvc:user_signin'), 'mvc:home');
    $this->deny('user', 'mvc:user_signin', 'navigate');
    
    $this->addResource(new Zend_Acl_Resource('mvc:user_signout'), 'mvc:home');
    $this->deny('guest', 'mvc:user_signout', 'navigate');
    $this->allow('user', 'mvc:user_signout', 'navigate');
    

    That way, it’s just another piece of navigation, and behaves like the rest, just with a little logic behind it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a database with two tables ( Table1 and Table2 ). They both
OK I hope this isn't too specific. I have a database driven CMS that
Can anybody have good answer when should be database driven development be used and
I have database with many tables. In the first table, I have a field
I have designed database tables (normalised, on an MS SQL server) and created a
I have a database file that is generated on a PC using Sqlite. This
I have a database-driven FAQ that is organised into sections and I am trying
We have created a database driven website using PHP with set cookies and now
I have an SQL database with multiple tables, and I am working on creating
I have a MS-access database. But it is on the shared drive. And it

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.