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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T15:10:10+00:00 2026-06-04T15:10:10+00:00

This is generic PHP question not just oscommerce. In the old version of oscommerce

  • 0

This is generic PHP question not just oscommerce.

In the old version of oscommerce a column was displayed by creating a object of a PHP class. If i include this it gets displayed

new infoBox2($info_box_contents) ;

But in new version i don’t have the liberty of doing this because of a lot of reasons. i MUST return all the HTML code generated by creating the above object as a string. This is what the string is right now –

$data = '<div class="ui-widget infoBoxContainer">' .'  <div class="ui-widget-header infoBoxHeading">' . MODULE_BOXES_CATEGORIES_BOX_TITLE . '</div>' .'  <div class="ui-widget-content infoBoxContents">' . $categories_string . '</div>' .'</div>';

You can notice it is predefined HTML code. I need to change the $data value to the dynamically generated HTML code generated when the object is created.
Any ideas on how to do this? i tried type casting the object as a string and using var_dump

var_dump is giving something like this

object(infoBox2)#8 (7) { ["table_border"]=> string(1) "0" ["table_width"]=> string(4) "100%" ["table_cellspacing"]=> string(1) "0" ["table_cellpadding"]=> string(1) "0" ["table_parameters"]=> string(22) " class="infoBox_table"" ["table_row_parameters"]=> string(0) "" ["table_data_parameters"]=> string(19) " class="infoBox_td"" }

which is not exactly the HTML code for it.

All that matters here is getting the HTML code generated by the PHP code as a string.HOW DO I DO IT?

If i place the new object creation in a seperate file and use file_get_contents then will it return the PHP code itself or will it return the HTML code generated by the php. Note here that i will be passing the filepath NOT a URL. I can’t pass the URL because of oscommerce internals which i will not go in depth now. i will use something Like this :-

file_get_contents("myfile.php");

NOT

file_get_contents("http://mywebsite.com/myfile.php");
  • 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-04T15:10:11+00:00Added an answer on June 4, 2026 at 3:10 pm

    You can use the technique called “output buffering”.

    # start redirecting output to a buffer
    ob_start();
    
    # execute the other PHP file
    include('myfile.php');
    
    # grab whatever got output since ob_start() (and stop buffering)
    $html = ob_get_clean();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to make this code generic: public final Object unwrap(Class arg0) { throw
This is not a specific question but a generic question which was in my
I realize this is a very generic question, but I guess I'm not really
This is more of a generic regex question than a PHP-specific one. I am
This is a very generic 'best practice' question, but here's an example. Let's say
This is kind of more generic question, isn't language-specific. More about idea and algorithm
This is a question about generic c++ event driven applications design. Lets assume that
So this is more of a generic question. I seem to keep finding myself
I think this is likely to be a generic .NET assembly loading question, but
This question refers to affiliate marketing, but really is a generic question about intercepting

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.