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

  • Home
  • SEARCH
  • 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 7068997
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T05:23:32+00:00 2026-05-28T05:23:32+00:00

I would like to find out which strategy is the best for links, forms

  • 0

I would like to find out which strategy is the best for links, forms and DOM elements appearance manipulation (show/hide) on top level of multi modular application (admin, default, etc) ??

It should be done through ACL and it’s usage I know well, permission are stored in DB.
If someone tries to access certain page (module/controller/action) that is not allowed for him, an info page is passed which says that he is not allowed. In that case all elements are visible.

I have a few strategies for elements appearance manipulation on my mind:

  1. To set in controller

    $this->view->allow_delete_link = $acl->isAllowed($role, 'delete_post'); // boolean
    

    and to ask in view file if it is true or false and show/hide

    <?php if ($this->allow_delete_link): ?>[link html] <?php endif; ?>
    

    The drawback here is if i have 50 links on page I will need to have 50 lines of code in my controller where I am doing this and I don’t like that very much.

  2. Similar to the first except ACL is static class so view file asks if:

    <?php if(My_Custom_Acl::getIsAllowed('some_resource', 'delete_post_action'){ echo 'link'; } ?>
    
  3. To make one view helper which I will call upon creating every link in which I would ask if user that is logged in has access, if yes return the whole link, if not, return “” or false.
    View helpers are very slow so that’s my last resort.

  4. To make separate view.phtml file for every group of users, then in controller, in which user is logged, show appropriate view.
    $this->render(‘xx_view’);
    This violates DRYS, so I think this method is not good.

Is there some other strategy for something like this, because I already see that I will have headache if I choose any of these 4.
Maybe some existing plugin/class for that would be the best?

thanks in advance !

I forgot to mention, that I am using Zend framework and Zend_Acl.

  • 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-28T05:23:33+00:00Added an answer on May 28, 2026 at 5:23 am

    3 is the best solution, because you often need to pass the database row to the isAllowed call (for example, if you need to test the owner of the post to choose if you can show the delete link).

    You can’t do this in the controller like you suggest in 1, because you will need one line for each row.

    2 is ugly.

    You can speed up resolution of view helpers by extending Zend_View: http://framework.zend.com/manual/fr/performance.view.html.

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

Sidebar

Related Questions

I would like to find out if any and which database links are being
Using R, I would like to find out which Samples (S1, S2, S3, S4,
I would like to know if there is the way to find out which
I would like to find out, in JavaScript, which element currently has focus. I've
Given a mathematical expression, I would like to find out which are the parts
In a Java Project of mine, I would like to find out programmatically which
I would like to find out safe ways of implementing three dimensional arrays of
I would like to find out if a particular python datetime object is older
I would like to find out where I would be able to find the
I would like to find out what is the most significant differences of MS

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.