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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T16:13:43+00:00 2026-06-03T16:13:43+00:00

I need to use the same custom made block 2 times on the same

  • 0

I need to use the same custom made block 2 times on the same page but with different values loaded from the database.

So I need to transfer a config value(Here called SimpleMenuInstanceRef) from my page.xml file to the block/model so each block knows what data to load from the database.

I am doing it with this block:

    <block template="simplemenu/leftMenuTemplate.phtml" type="simplemenu/standard" name="leftMenu" as="leftMenu" translate="label">
        <label>Left menu header</label>
        <action method="setSimpleMenuInstanceRef"><SimpleMenuInstanceRef>4</SimpleMenuInstanceRef></action>
        </block>

And this kinda works. In my leftMenuTemplate.phtml I can do a

echo $this->getSimpleMenuInstanceRef()

And this will show the value from the config.

But I need the value in my blocks _construct method so I can load data depending on its value. But doing a $this->getSimpleMenuInstanceRef in _construct don’t return anything. So how can I get the value in my block code, or do I need to transfer the value in an other way?

Edit: Changed __construct to _construct to match real code.

  • 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-06-03T16:13:45+00:00Added an answer on June 3, 2026 at 4:13 pm

    Yes, you need. Try to declare block as:

    <block instance="4" template="simplemenu/leftMenuTemplate.phtml" type="simplemenu/standard" name="leftMenu" as="leftMenu" translate="label">
        <label>Left menu header</label>
    </block>
    

    After doing this, you can easily access to the ‘instance’ var:

    protected function _construct() {
        parent::_construct();
        echo $this->getData('instance');
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

in a same html page i need to use jquerymobile ( www.jquerymobile.com ) and
I am trying to use the same custom renderer for all the columns in
I need to display 3 random images from SQLite database horizontally. Since it's impossible
I'd like to use a custom service in a Web Service Listener source, but
I've made a custom spinner but the sizing isn't exactly what I want it
I've got a custom component that I need to use if I create a
I need to use same widgets(buttons,editext,textviews) with same properties like width,height,textColor,size etc in multiple
I need use a progress bar with the pbstMarquee style, I read this question
So, I need use this event so I can navigate trought blog posts. I
Need to use own imaged markers instead built-in pins. I have several questions. 1.

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.