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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T20:01:31+00:00 2026-05-22T20:01:31+00:00

I’ve tried to find solution but with no results. My task is to write

  • 0

I’ve tried to find solution but with no results.
My task is to write module. It should insert some html into existing block.

I noticed that when I used layout .xml files I can just insert my block into some reference like

<reference name="product.info">
    <block type='googlethis/link' name="googlethis" 
           template="catalog/product/googlethis.phtml"/>
</reference>

and my block shows as well.

In other cases I should call getChildHtml() method and it’s not good because it makes to change template .phtml files.

So is there way to insert my phtml block into any other phtml block without calling getChildHtml() ?

  • 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-22T20:01:31+00:00Added an answer on May 22, 2026 at 8:01 pm

    There is a way to do this, although it is not an entirely elegant solution. It will work in most instances though and has proved helpful on occasion.

    Basically the idea is that you replace the block you want to render your block before/after in your layout XML, place that block as a child in your block and then render it’s output before/after yours.

    So let’s say you wanted to output a block before the totals block on the cart details page, you could do the following in your extension’s layout.xml

    <checkout_cart_index>
        <reference name="checkout.cart">
            <block type="myextension/block" name="myextension.block" as="myextension_block" template="myextension/template.phtml">
                <action method="setChild"><name>totals</name><block>totals</block></action>
            </block>
            <action method="setChild"><name>totals</name><block>myextension.block</block></action>
        </reference>
    </checkout_cart_index>
    

    Then in your template.phtml file you would have:

    <div id="myextension">
        // Your template code
    </div>
    
    // Render the totals block that you placed inside your block
    <?php echo $this->getChildHtml('totals'); ?>
    

    As I said, this won’t fit every situation and it’s not incredibly elegant, but it does work.

    Jon

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
Seemingly simple, but I cannot find anything relevant on the web. What is the
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I want to count how many characters a certain string has in PHP, but
this is what i have right now Drawing an RSS feed into the php,
I have some data like this: 1 2 3 4 5 9 2 6
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I need to clean up various Word 'smart' characters in user input, including but
That's pretty much it. I'm using Nokogiri to scrape a web page what has

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.