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 6470649
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T06:08:07+00:00 2026-05-25T06:08:07+00:00

I have a custom Action Helper that is working fine. It’s generating a dynamic

  • 0

I have a custom Action Helper that is working fine.
It’s generating a dynamic login box if user is not logged in, and if he is, it is generating a menu.

But here I have a problem.
I want to generate that menu from a small view that’s called user_menu.phtml

How I can get that view into my view helper, and assign it to an object?

Ok, some update, sorry for being stupid, actualy I have Action Helper:

I’m sorry If I was specific enough while writing my initial question.

So I have a Action helper in: library/Hlp/Action/Helper
That helper renders a form, if user is not loged inn.

Here is my Helper method, that does that job:

public function preDispatch() 
{
    $view = $this->getView();

    $identity = Zend_Auth::getInstance()->getIdentity();

    $session = new Zend_Session_Namespace('users_session');
    $user_id = $session->idd;

    if( !empty($identity) ) {
        $userModel = new Application_Model_Vartotojai();
        $user_email = $userModel->geUserRowBy('id', $user_id);
        $user_email = $user_email['email'];

        $view->login_meniu = $identity.' - 
    [id:'.$user_id.']<br />['.$user_email.'] <br/>
    <a href="/authentication/logout">Log OUt</a>';
    //here I would like to read view file to an object or some other variable
    //if posible to an object si I would be able to inject some values

    } else {        
        $form = new Application_Form_LoginForm();
        $view->login_meniu = $form;
        $view->register_link = '<br /><a href="/users/register">Register</a>';
        //here I would like to read view file to an object or some other variable
    //if posible to an object si I would be able to inject some values
    } 

Additionaly to that form I want to add some links, or other HTML content, that would br stored in a view file.

  • 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-25T06:08:07+00:00Added an answer on May 25, 2026 at 6:08 am

    All you have to do is to extend the Zend_View_Helper_Abstract class. Then you have the view object stored in the public property $view.

    By using that object you could render your file with

    return $this->view->partial('user_menu.phtml');
    

    Update

    Since you’ve updated your question I will update my answer leaving the previous answer because it’s still valid for your previous question.

    In your case you already have the $view object, to do what you’re asking for in the comments simply use the partial helper attached to the view in this way:

    $renderedScript = $view->partial('user_menu.phtml', 
        array('id' => $user_id, 'email' => $user_email['email']));
    

    By giving an array or an object as second argument to the partial call you can use them as model in your script file. Example:

    // content of user_menu.phtml
    <h1>Login info</h1>
    <p>
      [id: <?=$this->user_id?>]<br />
      [<?=$this->email?>] <br/>
      <a href="/authentication/logout">Log Out</a>'
    </p>
    

    P.s. I’ve used the short_tags + the equal sign (=) shorthand for echo in the view script, if you are not using them you should replace with <?php echo $this->email ?>

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

Sidebar

Related Questions

I have a custom installer action that updates the PATH environment, and creates an
We have a custom action that we want to run ONLY on a major
I have a custom action that runs in the very beginning of my Install
I have a C# Custom Action that loads an XML document and makes some
I have a custom action that adds/removes a certificate from the Trusted Root Certificates
I have a simple C++ DLL that implements a few custom actions for a
I have a few models that need to have custom find conditions placed on
I have a custom validation function in JavaScript in a user control on a
I have a custom built ajax [div] based dynamic dropdown. I have an [input]
I have a custom control that implements IPostBackEventHandler. Some client-side events invoke __doPostBack(controlID, eventArgs).

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.